/*------------------------------------------------------------------------------

Publication: Schakel, W. (2020) Representing the Rich: Economic and Political
	Inequality in Established Democracies. University of Amsterdam: Doctoral
	Dissertation.

Chapter: 4

Description: This do-file constructs the dataset used for the analyses of
	chapter 4. NOTE: IT IS NOT NECESSARY TO RUN THIS DO-FILE TO REPLICATE THE
	CHAPTER, BECAUSE THIS DO-FILE CONSTRUCTS THE SCHAKEL_2020_CHAPTER4_1_DATA
	FILE WHICH IS PROVIDED WITH THE SUPPLEMENTARY MATERIAL. However, the file is
	still included with the replication materials for the sake of transparancy,
	as it shows how the various sources were transformed into the data file used
	in the analyses.

Sections:
	
	1. Harmonizing the survey data: ISSP 1985
	2. Harmonizing the survey data: ISSP 1990
	3. Harmonizing the survey data: ISSP 1996
	4. Harmonizing the survey data: ISSP 2006
	5. Harmonizing the survey data: CSES Module 4
	6. Harmonizing the survey data: Asiabarometer 2003
	7. Calculating spending preferences by income
	8. Reshaping the data
	9. Adding data on party platforms
	10. Adding data on GDP, growth and unemployment
	11. Adding further country-level variables
	12. Final preparation

Data: ISSP Role of Government I-IV, downloaded in August 2017 from Gesis at:
	https://dbk.gesis.org/dbksearch/sdesc2.asp?no=1490 (Role of Government I)
	https://dbk.gesis.org/dbksearch/sdesc2.asp?no=1950 (Role of Government II)
	https://dbk.gesis.org/dbksearch/sdesc2.asp?no=2900 (Role of Government III)
	https://dbk.gesis.org/dbksearch/sdesc2.asp?no=4700 (Role of Government IV)

	Comparative Study of Electoral Systems Module 4, downloaded in November 2019 from:
	https://cses.org/data-download/module-4-2011-2016

	Asiabarometer 2003, downloaded in May 2018 from:
	https://www.asiabarometer.org/en/data

	Comparative Manifesto Project version 2019a, downloaded in November 2019 from:
	https://manifesto-project.wzb.eu/datasets

	ParlGov cabinet and party data, downloaded in June 2018 from:
	http://www.parlgov.org/data/table/view_cabinet/ (Cabinet)
	http://www.parlgov.org/data/table/view_party/ (Party)

	World Bank data on GDP, growth and unemployment, downloaded in June 2018 from:
	http://data.worldbank.org/indicator/NY.GDP.PCAP.KD (GDP per capita)
	http://data.worldbank.org/indicator/NY.GDP.PCAP.KD.ZG (Economic growth)
	http://data.worldbank.org/indicator/SL.UEM.TOTL.NE.ZS (Unemployment)

	Government spending data, downloaded in November 2018 from:
	https://data.worldbank.org/indicator/ms.mil.xpnd.gd.zs (Defense)
	https://data.worldbank.org/indicator/SE.XPD.TOTL.GD.ZS (Education)
	https://stats.oecd.org/Index.aspx?DataSetCode=EPER (Environment)
	https://stats.oecd.org/Index.aspx?datasetcode=SOCX_AGG (Welfare)
	https://ec.europa.eu/eurostat/web/government-finance-statistics/data/database
	(gov_10a_exp) (Culture and law and order)

	Quality of Government Standard Dataset, downloaded in November 2019 from:
	http://qog.pol.gu.se/data/datadownloads/qogstandarddata (Time-series Data)
	
	Comparative Political Data Set, downloaded in August 2017 from:
	http://www.cpds-data.org/index.php/data
	
	Varieties of Democracy (V-Dem) version 9, downloaded in November 2019 from:
	https://www.v-dem.net/en/data/data-version-9/

------------------------------------------------------------------------------*/

global data "YOUR PATH HERE"

/*------------------------------------------------------------------------------
 1. Harmonizing the survey data: ISSP 1985
------------------------------------------------------------------------------*/

use "$data\ZA1490.dta", clear

* Identifying variables
recode V3 (1=1) (2=12) (3=13) (4=40) (5=2) (8=19), gen(country)
gen wave=1
gen year=1985
replace year=1986 if country==1 | country==2

* The values of the weights in 1985 are 100000 times as large as in other years
gen weight=V141/100000

* Spending preferences
recode V89 V86 V85 V82 V83 V84 V87 V88 (1=100) (2=50) (3=0) (4=-50)			///
	(5=-100), gen(cul mil edu env hea law pen une)

gen wel=(hea+pen+une)/3

* Welfare state values and budget-cutting preferences
recode V101 V107 (4=-100) (3=-33.33) (2=33.33) (1=100), gen(V101_1 V107_1)
gen wsv=(V101_1 + V107_1) / 2

recode V76 (1=100) (2=50) (3=0) (4=-50) (5=-100), gen(bcp)

* Income
* For Germany, we use respondent income because family income is missing in 1985.
clonevar inc=V128
replace inc=V129 if V3==2

* Education
gen educ=V123

* Party affiliation
recode V130 V139 (1 2=0) (4 5=1) (else=.), gen(partyaff lr)
replace lr=partyaff if lr==. & partyaff!=.

keep country wave year weight cul-wel wsv bcp inc educ lr

tempfile issp85
save `issp85'

/*------------------------------------------------------------------------------
 2. Harmonizing the survey data: ISSP 1990
------------------------------------------------------------------------------*/

use "$data\ZA1950.dta", clear

recode v3 (1=1) (2=12) (4=13) (6=40) (7=15) (8=19) (10=26) (11=18) (else=.), gen(country)
gen wave=2
gen year=1990
replace year=1991 if v3==11

gen weight=v114

recode v40 v37 v36 v33 v34 v35 v38 v39 (1=100) (2=50) (3=0) (4=-50)			///
	(5=-100), gen(cul mil edu env hea law pen une)

gen wel=(hea+pen+une)/3

recode v49 v55 (4=-100) (3=-33.33) (2=33.33) (1=100), gen(v49_1 v55_1)
gen wsv=(v49_1+v55_1)/2

recode v27 (1=100) (2=50) (3=0) (4=-50) (5=-100), gen(bcp)

gen inc=v100

gen educ=v81
replace educ=. if country==12 & educ==9 | country==18 & educ==7

recode v82 v85 (1 2=0) (4 5=1) (else=.), gen(partyaff lr)
replace lr=partyaff if lr==. & partyaff!=.

drop if country==.
keep country wave year weight cul-wel wsv bcp inc educ lr

tempfile issp90
save `issp90'

/*------------------------------------------------------------------------------
 3. Harmonizing the survey data: ISSP 1996
------------------------------------------------------------------------------*/

use "$data\ZA2900.dta", clear

recode v3 (1=1) (2 3=12) (4=13) (6=40) (8=15) (9=19) (10=17) (12=26)		///
	(13=36) (14=8) (15=32) (16=27) (17=3) (18=30) (19=25) (20=4) (22 23=18)	///
	(24=20) (25=35) (26=21) (27=11) (28=7) (30=37) (else=.), gen(country)
gen wave=3
gen year=1996
replace year=1995 if country==32
replace year=1997 if inlist(country, 1, 3, 11, 25, 27, 30)
replace year=1998 if country==37

gen weight=v325

recode v32 v29 v28 v25 v26 v27 v30 v31 (1=100) (2=50) (3=0) (4=-50)			///
	(5=-100), gen(cul mil edu env hea law pen une)

gen wel=(hea+pen+une)/3

recode v36 v42 (4=-100) (3=-33.33) (2=33.33) (1=100), gen(v36_1 v42_1)
gen wsv=(v36_1+v42_1)/2

recode v19 (1=100) (2=50) (3=0) (4=-50) (5=-100), gen(bcp)

* For Israel, we use respondent income because family income is missing.
clonevar inc=v218
replace inc=v217 if v3==22 | v3==23

gen educ=v205

recode v223 v248 (1 2=0) (4 5=1) (else=.), gen(partyaff lr)
replace lr=partyaff if lr==. & partyaff!=.

* For some reason, the Irish Labour party and Fianna Fail are classified as
* centrist by the ISSP, when the CMP considers them left- and right wing, resp.
replace lr=0 if v237==3
replace lr=1 if v237==1

* Voting
recode v272 (1/97=0) (.=1), gen(vote)
replace vote=. if inlist(country, 1, 7, 37, 40)

drop if country==.
keep country wave year weight cul-wel wsv bcp inc educ lr vote

tempfile issp96
save `issp96'

/*------------------------------------------------------------------------------
 4. Harmonizing the survey data: ISSP 2006
------------------------------------------------------------------------------*/

use "$data\ZA4700.dta", clear

recode V3a (36=1) (124=4) (152=5) (158=38) (191=6) (203=8) (208=9) (246=10)	///
	(250=11) (276=12) (348=15) (372=17) (376=18) (392=20) (410=34) (428=21)	///
	(528=24) (554=25) (578=26) (616=27) (620=28) (643=30) (705=32) (710=33)	///
	(724=35) (752=36) (756=37) (826=13) (840=40) (else=.), gen(country)
gen wave=4
gen year=2006
replace year=2007 if inlist(country, 1, 18, 21, 30, 35, 37)
replace year=2008 if country==9 | country==27

recode V24 V21 V20 V17 V18 V19 V22 V23 (1=100) (2=50) (3=0) (4=-50)			///
	(5=-100), gen(cul mil edu env hea law pen une)

gen wel=(hea+pen+une)/3

recode V25 V31 (4=-100) (3=-33.33) (2=33.33) (1=100), gen(V25_1 V31_1)
gen wsv=(V25_1+V31_1)/2

recode V11 (1=100) (2=50) (3=0) (4=-50) (5=-100), gen(bcp)

gen inc=.

foreach var of varlist AU_INC-ZA_INC {
	replace inc=`var' if `var'!=.
	}

gen educ=degree+1

recode PARTY_LR (1 2=0) (4 5=1) (else=.), gen(lr)

* Again, the Irish party Fianna Fail should be classified as right-wing.
replace lr=1 if IE_PRTY==1

* Israeli parties are not labeled as left- or right wing.
replace lr=0 if IL_PRTY==1 | IL_PRTY==5
replace lr=1 if IL_PRTY==2 | IL_PRTY==3 | IL_PRTY==9

* The CMP labels the African National Congress as left-wing and the Democratic
* Party of South Africa as right-wing.
replace lr=0 if ZA_PRTY==2
replace lr=1 if ZA_PRTY==4

recode VOTE_LE (2=0), gen(vote)

drop if country==.
keep country wave year weight cul-wel bcp inc educ lr vote

tempfile issp06
save `issp06'

/*------------------------------------------------------------------------------
 5. Harmonizing the survey data: CSES Module 4
------------------------------------------------------------------------------*/

use "$data\cses4.dta", clear

encode D1006_NAM, gen(c)
* We don't use South Korea because income is missing there.
recode c (2=1) (3=2) (5=3) (6=4) (7=8) (8=10) (9=11) (10=12) (11=13)		///
	(12=14) (14=16) (15=17) (16=18) (17=20) (19=21) (20=22) (21=23) (22=25)	///
	(23=26) (26=27) (27=28) (29=29) (30=31) (32=32) (33=33) (34=36) (35=37)	///
	(36=38) (38=39) (39=40) (else=.), gen(country)
gen wave=5
gen year=D1028
replace year=D1018 if year==9999
* In the following country-years, a few people were surveyed later than the rest.
replace year=2013 if country==1 & year==2014
replace year=2014 if country==25 & year==2015
replace year=2011 if country==25 & year==2012
replace year=2013 if country==26 & year==2014
replace year=2012 if country==29 & year==2013
replace year=2013 if country==31 & year==2012
replace year=2012 if country==40 & year==2013
gen weight=D1012_2

* Note that there is an item on welfare benefits (D3001_8), which correlates at
* .57 with the average of health, pensions and unemployment.
recode D3001_4 D3001_2 D3001_1 D3001_7 D3001_5 D3001_3 D3001_8 (1=100)		///
	(2=50) (3=0) (4=-50) (5=-100) (7/9=.), gen(mil edu hea law pen une wel2)

* These are placeholder values.
gen cul=mil
gen env=mil
replace law=mil if country==17

gen wel=(hea+pen+une)/3

recode D2020 (7/9=.), gen(inc)

recode D2003 (96/99=.), gen(educ)

/* reg wel2 c.hea##c.hea c.pen##c.pen c.une##c.une
drop wel
gen wel=-1.7493 + .07483*hea + .00045*hea*hea + .2018*pen + .00058*pen*pen	///
	+ .4685*une - .00058*une*une */

clonevar lh=D3006_LH_PL
clonevar uh=D3006_UH_PL
clonevar dc=D3006_LH_DC
clonevar pr=D3006_PR_1

gen lr=.

replace lr=0 if country==1 & (dc==2 | dc==3)
replace lr=1 if country==1 & (dc==1 | dc==4)
replace lr=0 if country==2 & (lh==1 | lh==4)
replace lr=1 if country==2 & (lh==2 | lh==6)
replace lr=0 if country==3 & (lh==11 | lh==16)
replace lr=1 if country==3 & (lh==6 | lh==10 | lh==18)
replace lr=0 if country==4 & (dc==2 | dc==5)
replace lr=1 if country==4 & (dc==1 | dc==3)
replace lr=0 if country==8 & (lh==1 | lh==3 | lh==8)
replace lr=1 if country==8 & (lh==2 | lh==5)
replace lr=0 if country==11 & (pr==1 | pr==2 | pr==3 | pr==4 | pr==5)
replace lr=1 if country==11 & (pr==6 | pr==7)
replace lr=0 if country==12 & (lh==4 | lh==5 | lh==6)
replace lr=1 if country==12 & lh==7
replace lr=0 if country==13 & (dc==2 | dc==6)
replace lr=1 if country==13 & (dc==1 | dc==4)
replace lr=0 if country==14 & (lh==2 | lh==3 | lh==6 | lh==7)
replace lr=1 if country==14 & (lh==1 | lh==4 | lh==5 | lh==7)
replace lr=0 if country==17 & (dc==2 | dc==5 | dc==6 | dc==7)
replace lr=1 if country==17 & (dc==3)
replace lr=0 if country==18 & lh==3
replace lr=1 if country==18 & (lh==1 | lh==2 | lh==7 | lh==8)
replace lr=0 if country==20 & (uh==3 | uh==7 | uh==9)
replace lr=1 if country==20 & (uh==1 | uh==2 | uh==4 | uh==5)
replace lr=0 if country==21 & lh==1
replace lr=1 if country==21 & (lh==2 | lh==3)
replace lr=0 if country==22 & (uh==1 | uh==3 | uh==4 | uh==5 | uh==6 | uh==7)
replace lr=1 if country==22 & uh==2
replace lr=0 if country==23 & (lh==4 | lh==5 | lh==11)
replace lr=1 if country==23 & lh==8
replace lr=0 if country==25 & (lh==1 | lh==3)
replace lr=1 if country==25 & (lh==2 | lh==4 | lh==5 | lh==6 | lh==8)
replace lr=0 if country==29 & dc==1
replace lr=1 if country==29 & dc==2
replace lr=0 if country==31 & lh==3
replace lr=1 if country==31 & (lh==1 | lh==2 | lh==4 | lh==5 | lh==6)
replace lr=0 if country==37 & (lh==3 | lh==10 | lh==11)
replace lr=1 if country==37 & (lh==1 | lh==9)
replace lr=0 if country==40 & dc==1
replace lr=1 if country==40 & dc==2

recode D3005_LH (5 6=0) (7/9=.), gen(vote)
replace vote=0 if vote==. & D3005_PR_1==5 | D3005_PR_1==6
replace vote=1 if vote==. & D3005_PR_1==1
replace vote=0 if vote==. & D3005_UH==5 & country==20
replace vote=1 if vote==. & D3005_UH==1 & country==20

* We only keep the country-years that can be matched to a subsequent election
* in the manifesto data. This may change when the manifesto data is updated.
keep if inlist(country, 1,2,3,4,8,11,12,13,14,16,17,18,20,21,22,23,25,29,	///
	31,32,36,37,39,40)
drop if D1008==2015 & (country==4 | country==14 | country==22)
drop if D1008==2014 & country==21

keep country wave year weight cul mil edu env law wel hea pen une inc educ lr vote

tempfile cses4
save `cses4'

/*------------------------------------------------------------------------------
 6. Harmonizing the survey data: Asiabarometer 2003
------------------------------------------------------------------------------*/

* Japan and South Korea 2003
use "$data\AB03.dta", clear

keep if Country<3
recode Country (1=20) (2=34), gen(country)
gen wave=4
gen year=2003
gen weight=1

recode Q23_i Q23_e Q23_d Q23_a Q23_b Q23_c Q23_f Q23_g (1=100) (2=50) (3=0)	///
	(4=-50) (5=-100) (9=.),	gen(cul mil edu env hea law pen une)
gen wel=(hea+pen+une)/3
gen inc=F8_JP+1
recode inc (12=1) (100=.)
replace inc=F8_SK if F8_SK!=. & F8_SK!=99
gen educ=F3 if F3<7

keep country wave year weight cul mil edu env law wel hea pen une inc educ

tempfile ab03
save `ab03'

* Now we merge the datasets
use `issp85', replace
append using `issp90'
append using `issp96'
append using `issp06'
append using `cses4'
append using `ab03'

sort wave country year
egen cy=group(wave country year)

quietly sum cy
scalar m=r(max)

/*------------------------------------------------------------------------------
 7. Calculating spending preferences by income
------------------------------------------------------------------------------*/

tempfile incdata
save `incdata'

quietly forval cy=1/`=scalar(m)' {
	use `incdata', clear
	keep if cy==`cy'

	alpha hea pen une
	gen welrel6=r(alpha)

	* Creating quintiles
	foreach v of varlist inc educ {
		rename `v' `v'temp
		egen `v'=group(`v'temp)
		
		sum `v'
		bys `v': gen `v'freq=_N/r(N)
		by `v': gen `v'cfreq=_N/r(N) if _n==1
		replace `v'cfreq=sum(`v'cfreq)
		recode `v'freq `v'cfreq (min/max=.) if `v'==.

		distinct `v'
		scalar `v'=r(ndistinct)

		gen `v'var0=1
		gen `v'quin0=0

		forval qu=1/5 {
			gen `v'var`qu'=.

			forval i=1/`=scalar(`v')' {
				sum `v'cfreq if `v'==`i'
				replace `v'var`qu'=`i' if r(mean)>=`=`qu'/5' & `v'var`qu'==.
				}

			sum `v'var`=`qu'-1'
			scalar x`=`qu'-1'=r(mean)

			sum `v'var`qu'
			scalar x`qu'=r(mean)

			gen `v'quin`qu'=`v'freq if `v'>=`=scalar(x`=`qu'-1')' &	///
			`v'<=`=scalar(x`qu')'
			sum `v'cfreq if `v'==`=`=scalar(x`qu')'-1'
			replace `v'quin`qu'=`=`qu'/5'-r(mean) if `v'==`=scalar(x`qu')'
			}

		recode `v'quin* (.=0) if `v'!=.
		sum `v'cfreq if `v'==1
		if r(mean)>.2 {
			replace `v'quin1=.2 if `v'==1
			}

		if r(mean)>.4 {
			replace `v'quin2=.2 if `v'==1
			forval qu=3/5 {
				replace `v'quin`qu'=`v'quin`qu'-`v'quin`=`qu'-1'-			///
				`v'quin`=`qu'-2' if `v'==`=scalar(x`=`qu'-1')'
				}
			}

		if r(mean)<.4 {
			forval qu=2/5 {
				replace `v'quin`qu'=`v'quin`qu'-`v'quin`=`qu'-1'-			///
				`v'quin`=`qu'-2' if `v'==`=scalar(x`=`qu'-1')'
				}
			}

		forval qu=1/5 {
			replace `v'quin`qu'=0 if `v'quin`qu'<0
			gen weight_`v'`qu'=(`v'quin`qu'/`v'freq)*weight
			}
		}

	forval e=1/5 {
		forval i=1/5 {
			gen weight_i`i'e`e'=incquin`i'*educquin`e'*weight
			}
		}

	recode cul mil edu env law wel (.=.), gen(t1 t2 t3 t4 t5 t6)

	* Creating percentiles
	distinct inc
	local cat=r(ndistinct)
	gen inccat=`cat'

	xtile inc20temp=inc [pw=weight], n(20)
	egen inc20=group(inc20temp)
	egen incgroup=group(inc)
	replace inc20=incgroup if inccat<=20
	drop inccat incgroup

	egen inctot=count(inc20)
	gen incm=.
	sum inc20

	forval j=1/`r(max)' {
		egen incn`j'=count(inc20) if inc20==`j'
		sum incn`j'
		replace incn`j'=r(mean)
		egen incc`j'=rowtotal(incn*)
		}

	rename incc# incc#, renumber(2)
	gen incc1=0
	sum inc20

	forval j=1/`r(max)' {
		gen incm`j'=(incc`j' + (incn`j'/2))/inctot
		replace incm=incm`j' if inc20==`j'
		}

	* Party choice
	* There are some country-years where party choice was not recorded. We make
	* a random variable here to prevent errors in the loop, deleting it later.
	sum lr
	replace lr=rbinomial(1,.5) if r(N)==0
	
	* There are also several country-years with no or very few voters on one
	* side of the political spectrum.
	recode lr (.=1) if country==14 | country==28

	* Voting behavior
	* Voting is missing in the following country-years. Again, we replace the
	* missings with random values that will be deleted after the loop.
	replace vote=rbinomial(1,.5) if year<1992 | year==2003 | cy==15 |		///
		cy==18 | cy==36 | cy==37 | cy==47

	* Calculating preferences by quintiles
	forval t=1/6 {
		sum t`t' [aw=weight]
		gen all`t'=r(mean)
		
		forval i=1/5 {
			sum t`t' [aw=weight_inc`i']
			gen q`i'`t'=r(mean)
			}

		forval e=1/5 {
			sum t`t' [aw=weight_educ`e']
			gen e`e'`t'=r(mean)

			forval i=1/5 {
				sum t`t' [aw=weight_i`i'e`e']
				gen i`i'e`e'`t'=r(mean)
				}
			}

		* Calculating preferences by percentiles
		reg t`t' c.incm##c.incm [pw=weight]
		margins, at(incm=(.05 .1 .15 .2 .25 .3 .35 .4 .45 .5 .55 .6 .65 .7	///
			.75 .8 .85 .9 .95))
		matrix b=r(b)
		matrix v=r(V)
		gen p05`t'=b[1,1]
		gen p10`t'=b[1,2]
		gen p15`t'=b[1,3]
		gen p20`t'=b[1,4]
		gen p25`t'=b[1,5]
		gen p30`t'=b[1,6]
		gen p35`t'=b[1,7]
		gen p40`t'=b[1,8]
		gen p45`t'=b[1,9]
		gen p50`t'=b[1,10]
		gen p55`t'=b[1,11]
		gen p60`t'=b[1,12]
		gen p65`t'=b[1,13]
		gen p70`t'=b[1,14]
		gen p75`t'=b[1,15]
		gen p80`t'=b[1,16]
		gen p85`t'=b[1,17]
		gen p90`t'=b[1,18]
		gen p95`t'=b[1,19]

		gen weight10`t'=1/sqrt(v[2,2])
		gen weight30`t'=1/sqrt(v[6,6])
		gen weight50`t'=1/sqrt(v[10,10])
		gen weight70`t'=1/sqrt(v[14,14])
		gen weight90`t'=1/sqrt(v[18,18])

		* Calculating preferences by income and party choice
		forval lr=0/1 {
			sum t`t' if lr==`lr' [aw=weight]
			gen all_`lr'`t'=r(mean)

			forval i=1/5 {
				sum t`t' if lr==`lr' [aw=weight_inc`i']
				gen q`i'_`lr'`t'=r(mean)
				}

			reg t`t' c.incm##c.incm if lr==`lr' [pw=weight]
			margins, at(incm=(.05 .10 .30 .50 .70 .90 .95))
			matrix b=r(b)
			gen p05_`lr'`t'=b[1,1]
			gen p10_`lr'`t'=b[1,2]
			gen p30_`lr'`t'=b[1,3]
			gen p50_`lr'`t'=b[1,4]
			gen p70_`lr'`t'=b[1,5]
			gen p90_`lr'`t'=b[1,6]
			gen p95_`lr'`t'=b[1,7]
			}

		* Calculating preferences by income and party choice
		reg t`t' c.incm##i.vote [pw=weight]
		margins, at(incm=(.1(.4).9) vote=(0 1))
		matrix b=r(b)
		gen p10nv`t'=b[1,1]
		gen p10v`t'=b[1,2]
		gen p50nv`t'=b[1,3]
		gen p50v`t'=b[1,4]
		gen p90nv`t'=b[1,5]
		gen p90v`t'=b[1,6]
		}

	keep in 1
	keep country wave year cy welrel6 all1-p90v6

	tempfile cy`cy'
	save "`cy`cy''"
	}

clear

quietly forval cy=1/`=scalar(m)' {
	append using "`cy`cy''"
	}

/*------------------------------------------------------------------------------
 8. Reshaping the data
------------------------------------------------------------------------------*/

reshape long all q1 q2 q3 q4 q5 e1 e2 e3 e4 e5 i1e1 i1e2 i1e3 i1e4 i1e5		///
	i2e1 i2e2 i2e3 i2e4 i2e5 i3e1 i3e2 i3e3 i3e4 i3e5 i4e1 i4e2 i4e3 i4e4	///
	i4e5 i5e1 i5e2 i5e3 i5e4 i5e5 p05 p10 p15 p20 p25 p30 p35 p40 p45 p50	///
	p55 p60 p65 p70 p75 p80 p85 p90 p95 weight10 weight30 weight50 weight70	///
	weight90 all_0 q1_0 q2_0 q3_0 q4_0 q5_0 all_1 q1_1 q2_1 q3_1 q4_1 q5_1	///
	p05_0 p10_0 p30_0 p50_0 p70_0 p90_0 p95_0 p05_1 p10_1 p30_1 p50_1 p70_1	///
	p90_1 p95_1 p10v p10nv p50v p50nv p90v p90nv welrel, i(cy) j(topic)

gen source=1
replace source=2 if wave==5 & year>2010

label define country 1 "Australia" 2 "Austria" 3 "Bulgaria" 4 "Canada"		///
	5 "Chile" 6 "Croatia" 7 "Cyprus" 8 "Czech Republic" 9 "Denmark"			///
	10 "Finland" 11 "France" 12 "Germany" 13 "Great Britain" 14 "Greece"	///
	15 "Hungary" 16 "Iceland" 17 "Ireland" 18 "Israel" 19 "Italy"			///
	20 "Japan" 21 "Latvia" 22 "Mexico" 23 "Montenegro" 24 "Netherlands"		///
	25 "New Zealand" 26 "Norway" 27 "Poland" 28 "Portugal" 29 "Romania"		///
	30 "Russia" 31 "Serbia" 32 "Slovenia" 33 "South Africa"					///
	34 "South Korea" 35 "Spain" 36 "Sweden" 37 "Switzerland" 38 "Taiwan"	///
	39 "Turkey" 40 "United States", replace

label define topic 1 "Culture" 2 "Defense" 3 "Education" 4 "Environment"	///
	5 "Law and order" 6 "Welfare", replace

label define source 1 "ISSP" 2 "CSES" 3 "AB", replace

label values country country
label values topic topic
label values source source

decode country, gen(country2)
egen countrytopic=group(country topic)
rename cy countryyear
replace wave=4 if wave==5 & year==2003
drop if (topic==1 | topic==4) & wave==5
drop if topic==5 & country==17 & wave==5
rename *_0 *l
rename *_1 *r
recode alll-p95r (min/max=.) if inlist(countryyear,5,11,25,26,28,65,74,81)
recode allr-q5r p05r-p95r (min/max=.) if country==14 | country==28
gen id=_n

order id country country2 year source wave topic countryyear countrytopic	///
	all q1 q2 q3 q4 q5 p05 p10 p15 p20 p25 p30 p35 p40 p45 p50 p55 p60 p65	///
	p70 p75 p80 p85 p90 p95 alll q1l q2l q3l q4l q5l p05l p10l p30l p50l	///
	p70l p90l p95l allr q1r q2r q3r q4r q5r p05r p10r p30r p50r p70r p90r	///
	p95r p10v p50v p90v p10nv p50nv p90nv e1 e2 e3 e4 e5 i1e1 i1e2 i1e3		///
	i1e4 i1e5 i2e1 i2e2 i2e3 i2e4 i2e5 i3e1 i3e2 i3e3 i3e4 i3e5 i4e1 i4e2	///
	i4e3 i4e4 i4e5 i5e1 i5e2 i5e3 i5e4 i5e5 weight10 weight30 weight50		///
	weight70 weight90 welrel

tempfile isspcombined
save `isspcombined', replace

/*------------------------------------------------------------------------------
 9. Adding data on party platforms
------------------------------------------------------------------------------*/

* First we match the ParlGov cabinet data with the ParlGov party identifiers.
use "$data\ParlGov Parties.dta", clear

keep cmp party_id party_name* country*

tempfile parlgov_cmp
save `parlgov_cmp'

use "$data\ParlGov Cabinet.dta", clear

merge m:1 party_id using `parlgov_cmp'
drop if _merge==2
drop _merge

rename country_name countryname

keep countryname election_d* cabinet_party seats party_name_e* year cmp party_id

* We keep only one election per country-year. If a party was in the coalition
* following any of these elections, it counts as a coalition party.
collapse (mean) party=cmp seats=seats cabinet=cabinet_party,				///
	by(countryname year party_id party_name_english)
recode cabinet (0.1/0.92=1)

* There are two parties that still have multiple values within one country-year;
* we drop the duplicates for these two.
drop if party_id==1246 & year==2006 | party_id==1408 & year==2000

* We only keep countries and years we can merge with the CMP.
drop if year<1979
drop if inlist(countryname,"Belgium","Estonia","Lithuania","Luxembourg",	///
	"Malta","Slovakia")

* We merge the ParlGov data with the CMP using the party identifier.
preserve
	drop if party==.
	tempfile parlgov
	save `parlgov'
restore

* There are also some cabinet parties where the party identifier is missing, 
* which we merge using the number of seats they obtained. Before doing so, we
* correct the seat number for several parties in the ParlGov data.
keep if party==. & cabinet==1 & seats!=0
replace seats=24 if party_id==336 & year==2010
replace seats=8 if party_id==2271 & year==1997
replace seats=12 if party_id==1492 & year==2012
replace seats=17 if party_id==2093 & year==2012
replace seats=13 if party_id==2091 & year==2015
replace seats=6 if party_id==1863 & year==1999
replace seats=7 if party_id==1873 & year==2006
replace seats=115 if party_id==958 & year==2008
replace seats=41 if party_id==2 & year==2010
replace seats=149 if party_id==1592 & year==2015
replace seats=67 if party_id==840 & year==1996
replace seats=292 if party_id==382 & year==2013
replace seats=37 if party_id==2156 & year==2013
replace seats=22 if party_id==1942 & year==2011
replace seats=216 if party_id==1140 & year==2001

rename cabinet cabinet2

tempfile parlgov2
save `parlgov2'

* Comparative Manifesto Data.
use "$data\MPDataset_MPDS2019a_stata14.dta", clear
gen year=round(date/100,1)
rename absseat seats

merge m:1 countryname year party using `parlgov'
drop if _merge==2
drop _merge

merge m:1 countryname year seats using `parlgov2'
drop if _merge==2
drop _merge

replace cabinet=cabinet2 if cabinet2!=. & cabinet!=cabinet2

keep if country<16 | country==22 | (country>30 & country<52) | country==53	///
	| (country>54 & country<73) | country==74 | country==80 | country==81 | ///
	country==82 | country==86 | country==87 | (country>90 & country<96) | 	///
	country==97 | country==113 | country==171 | country==181
keep if year>1978

rename countryname c
rename partyabbrev pna

* These are countries that are not in the ParlGov data.
replace cabinet=1 if c=="Mexico" & pna=="PRI"
replace cabinet=0 if cabinet==. & c=="Mexico"
replace cabinet=1 if c=="Montenegro" & year==2012 & pna=="ECG"
replace cabinet=0 if cabinet==. & c=="Montenegro" & year==2012
replace cabinet=1 if c=="Montenegro" & year==2016 & (pna=="DPS CG" | pna=="BS" | pna=="SDCG")
replace cabinet=0 if cabinet==. & c=="Montenegro" & year==2016
replace cabinet=1 if c=="Russia" & year==1995 & (pna=="KPRF" | pna=="APR")
replace cabinet=0 if cabinet==. & c=="Russia" & year==1995
replace cabinet=1 if c=="Russia" & year==1999 & (pna=="Yedinstvo" | pna=="NDR" | pna=="SPS")
replace cabinet=0 if cabinet==. & c=="Russia" & year==1999
replace cabinet=1 if c=="Russia" & year>1999 & pna=="ER"
replace cabinet=0 if cabinet==. & c=="Russia" & year>1999
replace cabinet=1 if c=="Serbia" & year==2012 & (partyname=="Let's get Serbia moving - Tomislav Nikolic" | pna=="SPS/PUPS/JS")
replace cabinet=0 if cabinet==. & c=="Serbia" & year==2012
replace cabinet=1 if c=="Serbia" & year==2014 & (pna=="SNS/SDPS/NS/SPO/PS")
replace cabinet=0 if cabinet==. & c=="Serbia" & year==2014
replace cabinet=1 if c=="South Africa" & pna=="ANC"
replace cabinet=0 if cabinet==. & c=="South Africa"
replace cabinet=1 if c=="South Korea" & year==2000 & (pna=="MDP" | pna=="ULD")
replace cabinet=0 if cabinet==. & c=="South Korea" & year==2000
replace cabinet=1 if c=="South Korea" & year==2004 & pna=="Uri"
replace cabinet=0 if cabinet==. & c=="South Korea" & year==2004
replace cabinet=1 if c=="South Korea" & year==2008 & pna=="GNP"
replace cabinet=0 if cabinet==. & c=="South Korea" & year==2008
replace cabinet=1 if c=="South Korea" & year==2012 & pna=="NFP"
replace cabinet=0 if cabinet==. & c=="South Korea" & year==2012
replace cabinet=1 if c=="United States" & pna=="Democrats" & (year==1984 | year==1988 | year==1992 | year==2008)
replace cabinet=1 if c=="United States" & pna=="Republicans" & (year==1996 | year==2000 | year==2004 | year>2011)
replace cabinet=0 if cabinet==. & c=="United States"

* The ParlGov data is also incomplete for Romania.
replace cabinet=1 if cabinet==. & pna=="USL" & year==2012
replace cabinet=1 if cabinet==. & pna=="PSD" & year==2016

gen perseats_pi=seats/totseats

keep c country party year parfam cabinet perseats per504 per505 per506 per507	///
	per104 per105 per502 per501 per605

* There are a few parties that have multiple observations for the same year.
egen py=group(party year)
collapse (mean) country party year parfam cabinet perseats per504 per505	///
	per506 per507 per104 per105 per502 per501 per605, by(py c)
drop py

recode cabinet (.1/.9=1)

* Here, we do two things: we tag election years and we reshape the data twice to
* add non-election years to the long data.
gen elecyear=1

reshape wide per504 per505 per506 per507 per104 per105 per502 per501 per605	///
	perseats_pi elecyear cabinet, i(party) j(year)

forval i=1979/2017 {
	foreach c of numlist 11 12 13 14 15 22 31 32 33 34 35 41 42 43 51 53 55	///
	61 62 63 64 71 72 74 80 81 82 86 87 91 92 93 94 95 97 113 171 181 {
	quietly sum elecyear`i' if country==`c'
	quietly replace elecyear`i'=r(mean) if r(N)!=0 & country==`c'
	}
	}

reshape long per504 per505 per506 per507 per104 per105 per502 per501 per605	///
	perseats_pi elecyear cabinet, i(party) j(year)

* Party positions are interpolated (by party), seat changes are not.
foreach v of varlist per504 per505 per506 per507 per104 per105 per502		///
	per501 per605 {
	bys party: ipolate `v' year, gen(`v'i)
	}

replace perseats_pi=0 if perseats_pi==. & elecyear==1
bys party: ipolate perseats_pi year, gen(perseats_si)

tsset party year

replace perseats_pi=L.perseats_pi if L.perseats_pi!=. & perseats_pi==.
replace perseats_si=L.perseats_si if L.perseats_si!=. & perseats_si==.
replace cabinet=L.cabinet if L.cabinet!=. & cabinet==.
foreach v of varlist per504 per505 per506 per507 per104 per105 per502		///
	per501 per605 {
	replace `v'i=L.`v'i if L.`v'i!=. & `v'i==.
	}

gen ey=elecyear
order ey, after(elecyear)
replace elecyear=1 if F.elecyear==1 & elecyear==.
replace elecyear=2 if F.elecyear==1 & elecyear==.
replace elecyear=3 if F.elecyear==2 & elecyear==.
replace elecyear=4 if F.elecyear==3 & elecyear==.
replace elecyear=5 if F.elecyear==4 & elecyear==.
replace elecyear=6 if F.elecyear==5 & elecyear==.
replace elecyear=F.elecyear+1 if ey==1 & F.ey!=1

* Alternative operationalization: no position interpolation.
foreach v of varlist per504 per505 per506 per507 per104 per105 per502		///
	per501 per605 {
	gen `v'ni=`v'
	replace `v'ni=L.`v'ni if L.`v'ni!=. & `v'ni==.
	}

tsset, clear

recode parfam (10 20 30=0 "Left") (40 60=1 "Right") (else=.), gen(lr)

* We make party family into a string variable so that we can loop it below.
tostring parfam, gen(parfam2)
replace parfam2="sd" if parfam2=="30"
replace parfam2="soc" if parfam2=="20"
replace parfam2="gr" if parfam2=="10"
replace parfam2="lib" if parfam2=="40"
replace parfam2="con" if parfam2=="60"
replace parfam2="cd" if parfam2=="50"

foreach v of varlist per504 per505 per506 per507 per104 per105 per502		///
	per501 per605 {
	gen `v'l=ln(`v'i+0.5)
	}

quietly foreach v of newlist pi si {
preserve
	keep if cabinet==1
	collapse (mean) welp_gov_`v'=per504i weln_gov_`v'=per505i				///
	edup_gov_`v'=per506i edun_gov_`v'=per507i milp_gov_`v'=per104i			///
	miln_gov_`v'=per105i cul_gov_`v'=per502i env_gov_`v'=per501i			///
	law_gov_`v'=per605i [pw=perseats_`v'], by(c year)
	tempfile cmpgov_`v'
	save `cmpgov_`v''
restore

preserve
	keep if lr==0
	collapse (mean) welp_left_`v'=per504i weln_left_`v'=per505i				///
	edup_left_`v'=per506i edun_left_`v'=per507i milp_left_`v'=per104i		///
	miln_left_`v'=per105i cul_left_`v'=per502i env_left_`v'=per501i			///
	law_left_`v'=per605i [pw=perseats_`v'], by(c year)
	tempfile cmpleft_`v'
	save `cmpleft_`v''
restore

preserve
	keep if lr==1
	collapse (mean) welp_right_`v'=per504i weln_right_`v'=per505i			///
	edup_right_`v'=per506i edun_right_`v'=per507i milp_right_`v'=per104i	///
	miln_right_`v'=per105i cul_right_`v'=per502i env_right_`v'=per501i		///
	law_right_`v'=per605i [pw=perseats_`v'], by(c year)
	tempfile cmpright_`v'
	save `cmpright_`v''
restore

foreach p of newlist sd soc gr lib con cd {
	preserve
		drop if parfam2!="`p'"
		collapse (mean) welp_`p'_`v'=per504i weln_`p'_`v'=per505i			///
		edup_`p'_`v'=per506i edun_`p'_`v'=per507i milp_`p'_`v'=per104i		///
		miln_`p'_`v'=per105i cul_`p'_`v'=per502i env_`p'_`v'=per501i		///
		law_`p'_`v'=per605i [pw=perseats_`v'], by(c year)
		tempfile cmp`p'_`v'
		save `cmp`p'_`v''
	restore
	}

preserve
	collapse (mean) welp_leg_`v'=per504i weln_leg_`v'=per505i				///
	edup_leg_`v'=per506i edun_leg_`v'=per507i milp_leg_`v'=per104i			///
	miln_leg_`v'=per105i cul_leg_`v'=per502i env_leg_`v'=per501i			///
	law_leg_`v'=per605i [pw=perseats_`v'], by(c year)
	tempfile cmpleg_`v'
	save `cmpleg_`v''
restore
}

preserve
	collapse (mean) welp_leg_nw=per504i weln_leg_nw=per505i					///
	edup_leg_nw=per506i edun_leg_nw=per507i milp_leg_nw=per104i				///
	miln_leg_nw=per105i cul_leg_nw=per502i env_leg_nw=per501i				///
	law_leg_nw=per605i ey=elecyear, by(c year)
	tempfile cmpleg_nw
	save `cmpleg_nw'
restore

preserve
	collapse (mean) welp_leg_ni=per504ni weln_leg_ni=per505ni				///
	edup_leg_ni=per506ni edun_leg_ni=per507ni milp_leg_ni=per104ni			///
	miln_leg_ni=per105ni cul_leg_ni=per502ni env_leg_ni=per501ni			///
	law_leg_ni=per605ni ey=elecyear [pw=perseats_pi], by(c year)
	tempfile cmpleg_ni
	save `cmpleg_ni'
restore

* Alternative dependent variable: creating mean of logs instead of log of means
preserve
	collapse (mean) welp_leg_log=per504l weln_leg_log=per505l				///
	edup_leg_log=per506l edun_leg_log=per507l milp_leg_log=per104l			///
	miln_leg_log=per105l cul_leg_log=per502l env_leg_log=per501l			///
	law_leg_log=per605l, by(c year)
	tempfile cmpleg_log
	save `cmpleg_log'
restore

use `cmpleg_pi', clear
merge 1:1 c year using `cmpleg_si', nogen
merge 1:1 c year using `cmpgov_pi', nogen
merge 1:1 c year using `cmpgov_si', nogen
merge 1:1 c year using `cmpleft_pi', nogen
merge 1:1 c year using `cmpleft_si', nogen
merge 1:1 c year using `cmpright_pi', nogen
merge 1:1 c year using `cmpright_si', nogen
merge 1:1 c year using `cmpsd_pi', nogen
merge 1:1 c year using `cmpsd_si', nogen
merge 1:1 c year using `cmpsoc_pi', nogen
merge 1:1 c year using `cmpsoc_si', nogen
merge 1:1 c year using `cmpgr_pi', nogen
merge 1:1 c year using `cmpgr_si', nogen
merge 1:1 c year using `cmplib_pi', nogen
merge 1:1 c year using `cmplib_si', nogen
merge 1:1 c year using `cmpcon_pi', nogen
merge 1:1 c year using `cmpcon_si', nogen
merge 1:1 c year using `cmpcd_pi', nogen
merge 1:1 c year using `cmpcd_si', nogen
merge 1:1 c year using `cmpleg_nw', nogen
merge 1:1 c year using `cmpleg_ni', nogen
merge 1:1 c year using `cmpleg_log', nogen

* Here we generate the logged versions of the dependent variable.
quietly foreach var of varlist welp_leg_pi-law_leg_ni {
	gen l`var'=ln(`var'+0.5)
	}

quietly foreach v of newlist wel edu mil {
	foreach v2 of newlist leg gov left right sd soc gr lib con cd {
		foreach v3 of newlist pi si {
			gen `v'_`v2'_`v3'=`v'p_`v2'_`v3'-`v'n_`v2'_`v3'
			gen l`v'_`v2'_`v3'=ln(`v'p_`v2'_`v3'+0.5)-ln(`v'n_`v2'_`v3'+0.5)
			}
		}
	}

foreach v of newlist nw ni {
	gen wel_leg_`v'=welp_leg_`v'-weln_leg_`v'
	gen edu_leg_`v'=edup_leg_`v'-edun_leg_`v'
	gen mil_leg_`v'=milp_leg_`v'-miln_leg_`v'
	gen lwel_leg_`v'=ln(welp_leg_`v'+0.5)-ln(weln_leg_`v'+0.5)
	gen ledu_leg_`v'=ln(edup_leg_`v'+0.5)-ln(edun_leg_`v'+0.5)
	gen lmil_leg_`v'=ln(milp_leg_`v'+0.5)-ln(miln_leg_`v'+0.5)
	}

gen wel_leg_log=welp_leg_log-weln_leg_log
gen edu_leg_log=edup_leg_log-edun_leg_log
gen mil_leg_log=milp_leg_log-miln_leg_log

drop *p_leg_pi *n_leg_pi *p_gov_pi *n_gov_pi *p_sd_pi *n_sd_pi *p_soc_pi	///
	*n_soc_pi *p_gr_pi *n_gr_pi *p_lib_pi *n_lib_pi *p_cd_pi *n_cd_pi		///
	*p_con_pi *n_con_pi *p_left_pi *n_left_pi *p_right_pi *n_right_pi		///
	*p_leg_si *n_leg_si *p_gov_si *n_gov_si *p_sd_si *n_sd_si *p_soc_si		///
	*n_soc_si *p_gr_si *n_gr_si *p_lib_si *n_lib_si *p_cd_si *n_cd_si		///
	*p_con_si *n_con_si *p_left_si *n_left_si *p_right_si *n_right_si		///
	*p_leg_nw *n_leg_nw *p_leg_ni *n_leg_ni *p_leg_log *n_leg_log

rename c country2
encode country2, gen(country)

* We rename the variables so they can be reshaped.
foreach v of newlist leg gov left right sd soc gr lib con cd {
	foreach v2 of newlist pi si {
		rename cul_`v'_`v2' `v'`v2't1
		rename mil_`v'_`v2' `v'`v2't2
		rename edu_`v'_`v2' `v'`v2't3
		rename env_`v'_`v2' `v'`v2't4
		rename law_`v'_`v2' `v'`v2't5
		rename wel_`v'_`v2' `v'`v2't6

		rename lcul_`v'_`v2' l`v'`v2't1
		rename lmil_`v'_`v2' l`v'`v2't2
		rename ledu_`v'_`v2' l`v'`v2't3
		rename lenv_`v'_`v2' l`v'`v2't4
		rename llaw_`v'_`v2' l`v'`v2't5
		rename lwel_`v'_`v2' l`v'`v2't6
		}
	}

foreach v of newlist nw ni log {
	rename cul_leg_`v' leg`v't1
	rename mil_leg_`v' leg`v't2
	rename edu_leg_`v' leg`v't3
	rename env_leg_`v' leg`v't4
	rename law_leg_`v' leg`v't5
	rename wel_leg_`v' leg`v't6
	}

foreach v of newlist nw ni {
	rename lcul_leg_`v' lleg`v't1
	rename lmil_leg_`v' lleg`v't2
	rename ledu_leg_`v' lleg`v't3
	rename lenv_leg_`v' lleg`v't4
	rename llaw_leg_`v' lleg`v't5
	rename lwel_leg_`v' lleg`v't6
	}

rename ey elecyear
drop ley

replace country2="Great Britain" if country2=="United Kingdom"
order country country2 year elecyear legpit1 legpit2 legpit3 legpit4		///
	legpit5 legpit6 legsit1 legsit2 legsit3 legsit4 legsit5 legsit6			///
	llegpit1 llegpit2 llegpit3 llegpit4 llegpit5 llegpit6 llegsit1 llegsit2	///
	llegsit3 llegsit4 llegsit5 llegsit6 govpit1 govpit2 govpit3 govpit4		///
	govpit5 govpit6 govsit1 govsit2 govsit3 govsit4 govsit5 govsit6			///
	lgovpit1 lgovpit2 lgovpit3 lgovpit4 lgovpit5 lgovpit6 lgovsit1 lgovsit2	///
	lgovsit3 lgovsit4 lgovsit5 lgovsit6 leftpit1 leftpit2 leftpit3 leftpit4	///
	leftpit5 leftpit6 leftsit1 leftsit2 leftsit3 leftsit4 leftsit5 leftsit6	///
	lleftpit1 lleftpit2 lleftpit3 lleftpit4 lleftpit5 lleftpit6 lleftsit1	///
	lleftsit2 lleftsit3 lleftsit4 lleftsit5 lleftsit6 rightpit1 rightpit2	///
	rightpit3 rightpit4 rightpit5 rightpit6 rightsit1 rightsit2 rightsit3	///
	rightsit4 rightsit5 rightsit6 lrightpit1 lrightpit2 lrightpit3			///
	lrightpit4 lrightpit5 lrightpit6 lrightsit1 lrightsit2 lrightsit3		///
	lrightsit4 lrightsit5 lrightsit6 sdpit1 sdpit2 sdpit3 sdpit4 sdpit5		///
	sdpit6 sdsit1 sdsit2 sdsit3 sdsit4 sdsit5 sdsit6 lsdpit1 lsdpit2		///
	lsdpit3 lsdpit4 lsdpit5 lsdpit6 lsdsit1 lsdsit2 lsdsit3 lsdsit4 lsdsit5	///
	lsdsit6 socpit1 socpit2 socpit3 socpit4 socpit5 socpit6 socsit1 socsit2	///
	socsit3 socsit4 socsit5 socsit6 lsocpit1 lsocpit2 lsocpit3 lsocpit4		///
	lsocpit5 lsocpit6 lsocsit1 lsocsit2 lsocsit3 lsocsit4 lsocsit5 lsocsit6	///
	grpit1 grpit2 grpit3 grpit4 grpit5 grpit6 grsit1 grsit2 grsit3 grsit4	///
	grsit5 grsit6 lgrpit1 lgrpit2 lgrpit3 lgrpit4 lgrpit5 lgrpit6 lgrsit1	///
	lgrsit2 lgrsit3 lgrsit4 lgrsit5 lgrsit6 libpit1 libpit2 libpit3 libpit4	///
	libpit5 libpit6 libsit1 libsit2 libsit3 libsit4 libsit5 libsit6			///
	llibpit1 llibpit2 llibpit3 llibpit4 llibpit5 llibpit6 llibsit1 llibsit2	///
	llibsit3 llibsit4 llibsit5 llibsit6 conpit1 conpit2 conpit3 conpit4		///
	conpit5 conpit6 consit1 consit2 consit3 consit4 consit5 consit6			///
	lconpit1 lconpit2 lconpit3 lconpit4 lconpit5 lconpit6 lconsit1 lconsit2	///
	lconsit3 lconsit4 lconsit5 lconsit6 cdpit1 cdpit2 cdpit3 cdpit4 cdpit5	///
	cdpit6 cdsit1 cdsit2 cdsit3 cdsit4 cdsit5 cdsit6 lcdpit1 lcdpit2		///
	lcdpit3 lcdpit4 lcdpit5 lcdpit6 lcdsit1 lcdsit2 lcdsit3 lcdsit4 lcdsit5	///
	lcdsit6 legnwt1 legnwt2 legnwt3 legnwt4 legnwt5 legnwt6 llegnwt1		///
	llegnwt2 llegnwt3 llegnwt4 llegnwt5 llegnwt6 legnit1 legnit2 legnit3	///
	legnit4 legnit5 legnit6 llegnit1 llegnit2 llegnit3 llegnit4 llegnit5	///
	llegnit6 leglogt1 leglogt2 leglogt3 leglogt4 leglogt5 leglogt6, first

tempfile time
save `time'

quietly foreach var in legpit llegpit govpit lgovpit leftpit lleftpit		///
	rightpit lrightpit sdpit lsdpit socpit lsocpit grpit lgrpit libpit		///
	llibpit conpit lconpit cdpit lcdpit legsit llegsit govsit lgovsit		///
	leftsit lleftsit rightsit lrightsit sdsit lsdsit socsit lsocsit grsit	///
	lgrsit libsit llibsit consit lconsit cdsit lcdsit legnwt llegnwt legnit	///
	llegnit leglogt {
	use `time', clear
	keep country* year elecyear `var'*
	xtset country year
	
	forval i=1/5 {
		forval j=1/6 {
			gen `var'`i'`j'=F`i'.`var'`j'
			gen d`var'`i'`j'=F`i'.`var'`j'-`var'`j'
			gen `var'min`i'`j'=L`i'.`var'`j'
			}
		}

	xtset, clear

	egen countryyear=group(country2 year)
	
	reshape long `var' `var'1 `var'2 `var'3 `var'4 `var'5 `var'min1			///
	`var'min2 `var'min3 `var'min4 `var'min5 d`var'1 d`var'2 d`var'3 d`var'4	///
	d`var'5, i(countryyear) j(topic)

	egen d`var'av13=rowmean(d`var'1 d`var'2 d`var'3)
	egen d`var'av14=rowmean(d`var'1 d`var'2 d`var'3 d`var'4)
	egen d`var'av15=rowmean(d`var'1 d`var'2 d`var'3 d`var'4 d`var'5)

	egen miss`var'3=rowmiss(d`var'1 d`var'2 d`var'3)
	egen miss`var'4=rowmiss(d`var'1 d`var'2 d`var'3 d`var'4)
	egen miss`var'5=rowmiss(d`var'1 d`var'2 d`var'3 d`var'4 d`var'5)

	replace d`var'av13=. if miss`var'3>1
	replace d`var'av14=. if miss`var'4>1
	replace d`var'av15=. if miss`var'5>1

	drop miss`var'* d`var'1 d`var'2 d`var'3 d`var'4 d`var'5
	
	order `var'*, alpha last
	order d`var'*, alpha last
	sort country year topic

	tempfile temp`var'
	save "`temp`var''"
	}

clear

use `templegpit', clear

quietly foreach var in llegpit govpit lgovpit leftpit lleftpit				///
	rightpit lrightpit sdpit lsdpit socpit lsocpit grpit lgrpit libpit		///
	llibpit conpit lconpit cdpit lcdpit legsit llegsit govsit lgovsit		///
	leftsit lleftsit rightsit lrightsit sdsit lsdsit socsit lsocsit grsit	///
	lgrsit libsit llibsit consit lconsit cdsit lcdsit legnwt llegnwt legnit	///
	llegnit leglogt {
	merge 1:1 country year topic using "`temp`var''", nogen
	}

drop countryyear country

tempfile party
save `party'

use `isspcombined', clear

merge 1:1 country2 topic year using `party'
drop if _merge==1 | _merge==2
drop _merge

tempfile data
save `data'

/*------------------------------------------------------------------------------
 10. Adding data on GDP, growth and unemployment
------------------------------------------------------------------------------*/

* Note: we downloaded the data on all three indicators from the databank on the
* World Bank website, put them on one Excel sheet and copied them into Stata.
use "$data\WorldBank.dta", clear

drop countrycode
rename countryname country2
replace country2="Great Britain" if country2=="United Kingdom"
replace country2="Russia" if country2=="Russian Federation"
replace country2="Slovakia" if country2=="Slovak Republic"
replace country2="South Korea" if country2=="Korea, Rep."

rename gdp* vart1*
rename growth* vart2*
rename unemp* vart3*

reshape long vart1 vart2 vart3, i(country2) j(year)
encode country2, gen(ccode)

xtset ccode year

forval i=1/3 {
	forval j=1/5 {
	quietly gen vart`j'`i'=F`j'.vart`i'
	quietly gen dvart`j'`i'=(F`j'.vart`i'-vart`i')/vart`i'*100
	}

	egen dvartav13`i'=rowmean(dvart1`i' dvart2`i' dvart3`i')
	egen dvartav14`i'=rowmean(dvart1`i' dvart2`i' dvart3`i' dvart4`i')
	egen dvartav15`i'=rowmean(dvart1`i' dvart2`i' dvart3`i' dvart4`i' dvart5`i')

	egen miss3`i'=rowmiss(dvart1`i' dvart2`i' dvart3`i')
	egen miss4`i'=rowmiss(dvart1`i' dvart2`i' dvart3`i' dvart4`i')
	egen miss5`i'=rowmiss(dvart1`i' dvart2`i' dvart3`i' dvart4`i' dvart5`i')

	replace dvartav13`i'=. if miss3`i'>1
	replace dvartav14`i'=. if miss4`i'>1
	replace dvartav15`i'=. if miss5`i'>1

	drop dvart1`i' dvart2`i' dvart3`i' dvart4`i' dvart5`i' miss3`i' miss4`i' miss5`i'
	}

rename dvartav*1 dgdptav*
rename dvartav*2 dgrowthtav*
rename dvartav*3 dunemptav*
rename vart*1 gdpt*
rename vart*2 growtht*
rename vart*3 unempt*
order gdpt-dunemptav15, alpha last
order gdpt* dgdpt* growtht* dgrowtht* unempt* dunempt*, last
drop ccode

gen loggdpt=ln(gdpt)

tempfile wb
save `wb'

use `data', clear

merge m:1 country2 year using `wb'
drop if _merge==2
drop _merge

tempfile data
save `data', replace

/*------------------------------------------------------------------------------
 11. Adding further country-level variables
------------------------------------------------------------------------------*/

* Government spending
* Note: we downloaded the data for all six policy areas from the sources listed
* above on the, put them on one Excel sheet and copied them into Stata.
use "$data\WB-OECD-ES Spending.dta", clear

rename country country2
replace country2="Great Britain" if country2=="United Kingdom"

rename cul* spend1*
rename def* spend2*
rename edu* spend3*
rename env* spend4*
rename law* spend5*
rename wel* spend6*

reshape long spend1 spend2 spend3 spend4 spend5 spend6, i(country2) j(year)
gen temp=_n
reshape long spend, i(temp) j(topic)
drop temp

tempfile spend
save `spend'

use `data', clear

merge m:1 country2 year topic using `spend'
drop if _merge==2
drop _merge

save `data', replace

* Electoral system
* Note: the QOG data has been slightly truncated to 2048 variables so that it
* can be opened with my current version of Stata.
use "$data\qog_std_ts_jan19.dta", clear

gen country2=cname
replace country2="Cyprus" if country2=="Cyprus (1975-)"
replace country2="France" if country2=="France (1963-)"
replace country2="Great Britain" if country2=="United Kingdom"
replace country2="South Korea" if country2=="Korea, South"
recode gol_est (1=1 "Majoritarian") (3=2 "Mixed") (2=3 "Proportional"), gen(elecsys)

* Inequality
bys ccode: ipolate wdi_gini year, gen(gini)

* Age of democracy
* Note that there is another age of democracy variable (iaep_const), but the one
* we use has fewer missing values. (The two are correlated at 0.95.)
gen agedem=year-ccp_systyear
replace agedem=0 if mi(agedem)

* Voter turnout
* Note that the 'ideavt_legvt' variable for the United States alternates between
* presidential and Congressional elections. We only use the former.
gen turnout=ideavt_legvt
gen turnout2=ideavt_presvt

recode turnout turnout2 (min/max=.) if ccode==840
replace turnout=ideavt_legvt if inlist(year,1982,1986,1990,1994,1998,2002,2006,2010)
replace turnout2=ideavt_legvt if ccode==840 &								///
	inlist(year,1984,1988,1992,1996,2000,2004,2008,2012)

tsset ccode year
replace turnout=L.turnout if turnout==. & L.turnout!=.
replace turnout2=L.turnout2 if turnout2==. & L.turnout2!=.

bys cname: ipolate vi_udr year, gen(ud2)

keep year country2 elecsys agedem gini turnout* vdem_egal ud2 gol_adm

tempfile qog
save `qog'

use `data', clear

merge m:1 country2 year using `qog'
drop if _merge==2
drop _merge

save `data', replace

* Federalism
use "$data\CPDS.dta", clear

gen country2=country
replace country2="Great Britain" if country2=="United Kingdom"
replace country2="United States" if country2=="USA"
encode country if country!="Bulgaria" & country!="Croatia"					///
	& country!="Cyprus" & country!="Czech Republic" & country!="Estonia"	///
	& country!="Hungary" & country!="Latvia" & country!="Lithuania"			///
	& country!="Poland" & country!="Romania" & country!="Slovakia"			///
	& country!="Slovenia", gen(ctemp)
gen fedindex=lfed

forval i=1/24 {
	quietly sum fedindex if ctemp==`i' & year==1981
	recode fedindex (.=`r(mean)') if ctemp==`i' & year>1981
	}

rename fed fedcat
rename effpar_leg effpar
rename dis_gall gallindex
rename gov_party cabcomp
rename gov_left1 leftgov
rename gov_right1 rightgov
rename ud ud2
rename ud_ipol ud

keep year country2 fedcat fedindex effpar gallindex cabcomp leftgov rightgov ud

tempfile cpds
save `cpds'

use `data', clear

merge m:1 country2 year using `cpds'
drop if _merge==2
drop _merge

replace ud=ud2 if ud==. & ud2!=.
drop ud2

save `data', replace

* Collective bargaining coverage
use "$data\OECD_CBC.dta", clear

replace country="Great Britain" if country=="United Kingdom"
replace country="South Korea" if country=="Korea"

reshape long cbc, i(country) j(year)
bys country: ipolate cbc year, gen(cbc2)

* We extrapolate Israel's last value (2012) to 2013
replace cbc2=26.10-3.78 if country=="Israel" & year==2013

keep country year cbc2
rename country country2
rename cbc2 cbc

tempfile oecd_cbc
save `oecd_cbc'

use `data', clear

merge m:1 country2 year using `oecd_cbc'
drop if _merge==2
drop _merge

save `data', replace

* V-Dem
use "$data\V-Dem-CY-Core-v9.dta", clear

gen country2=country_name
replace country2="Great Britain" if country2=="United Kingdom"
replace country2="United States" if country2=="United States of America"
rename v2pepwrses vdem_egal2 // Note: a high score denotes equal representation

drop if year<1980
keep country2 year vdem_egal2

tempfile vdem
save `vdem'

use `data', clear

merge m:1 country2 year using `vdem'
drop if _merge==2
drop _merge

save `data', replace

* Campaign finance regulations
use "C:\Users\woute\surfdrive\Documents\PhD\Paper 3\Political finance index V2.dta", clear

label define limit 0 "No" 1 "Yes", replace

foreach var of varlist corpdon donlimit spendlimit {
	rename `var' `var'2
	encode `var', gen(`var')
	label values `var' limit
	}

recode corpdon spendlimit (1=0) (2=.) (3=1)
recode donlimit (1=0) (2=.) (3/6=1)

gen campreg=(corpdon+donlimit+spendlimit)/3

replace country="Great Britain" if country=="United Kingdom"
replace country="Russia" if country=="Russian Federation"
replace country="South Korea" if country=="Korea, Republic of"

format %8.0g donlimit
rename country country2
keep country2 corpdon donlimit spendlimit campreg

tempfile campreg
save `campreg'

use `data', clear

merge m:1 country2 using `campreg'
drop if _merge==2
drop _merge

/*------------------------------------------------------------------------------
 12. Final preparation
------------------------------------------------------------------------------*/

format %14s country2

* These are country-years where the most recent election took place shortly
* after the survey
forval i=5(-1)2 {
	foreach var of newlist leg gov left right sd lib cd con {
		replace `var'pit`i'=. if `var'pit`i'==`var'pit`=`i'-1' & `var'pit`i'!=0
		replace l`var'pit`i'=. if l`var'pit`i'==l`var'pit`=`i'-1' & l`var'pit`i'!=0
		replace `var'sit`i'=. if `var'sit`i'==`var'sit`=`i'-1' & `var'sit`i'!=0
		replace l`var'sit`i'=. if l`var'sit`i'==l`var'sit`=`i'-1' & l`var'sit`i'!=0
		}

	replace legnwt`i'=. if legnwt`i'==legnwt`=`i'-1' & legnwt`i'!=0
	replace llegnwt`i'=. if llegnwt`i'==llegnwt`=`i'-1' & llegnwt`i'!=0
	}

* There is one country-year with a missing value on GDP and one with a missing
* value on growth. For these, we use the values of t+1.
replace gdpt=gdpt1 if gdpt==. & gdpt1!=.
replace growtht=growtht1 if growtht==. & growtht1!=.

gen llegnite1=llegnit1 if llegnit1!=llegnit
replace llegnite1=llegnit2 if llegnit2!=llegnit & llegnite1==.
replace llegnite1=llegnit3 if llegnit3!=llegnit & llegnite1==.
replace llegnite1=llegnit4 if llegnit4!=llegnit & llegnite1==.
replace llegnite1=llegnit5 if llegnit5!=llegnit & llegnite1==.

* Although these variables are part of the data preparation here, we drop them
* because the dataset is quite bloated and they are currently not used.
drop sdsit-dlsdsitav15 socsit-dlsocsitav15 grsit-dlgrsitav15				///
	libsit-dllibsitav15 consit-dlconsitav15 cdsit-dlcdsitav15

order elecyear, after(year)
order llegnite1, after(dllegnitav15)
drop countryyear countrytopic
egen countryyear=group(country year)
egen countrytopic=group(country topic)
order countryyear countrytopic, after(topic)
order vdem_egal, after(cbc)
rename gol_adm adm
gen logadm=ln(adm)
order adm logadm fedcat fedindex ud, after(gallindex)
replace id=_n

label var id "ID"
label var country "Country"
label var country2 "Country (string)"
label var source "Data source"
label var wave "Survey wave"
label var year "Survey year"
label var elecyear "Years until first election after survey"
label var topic "Topic"
label var countryyear "Country-year"
label var countrytopic "Country-topic"
label var all "Overall preferences"
label var q1 "Quintile 1 preferences"
label var q2 "Quintile 2 preferences"
label var q3 "Quintile 3 preferences"
label var q4 "Quintile 4 preferences"
label var q5 "Quintile 5 preferences"
label var p05 "Percentile 5 preferences"
label var p10 "Percentile 10 preferences"
label var p15 "Percentile 15 preferences"
label var p20 "Percentile 20 preferences"
label var p25 "Percentile 25 preferences"
label var p30 "Percentile 30 preferences"
label var p35 "Percentile 35 preferences"
label var p40 "Percentile 40 preferences"
label var p45 "Percentile 45 preferences"
label var p50 "Percentile 50 preferences"
label var p55 "Percentile 55 preferences"
label var p60 "Percentile 60 preferences"
label var p65 "Percentile 65 preferences"
label var p70 "Percentile 70 preferences"
label var p75 "Percentile 75 preferences"
label var p80 "Percentile 80 preferences"
label var p85 "Percentile 85 preferences"
label var p90 "Percentile 90 preferences"
label var p95 "Percentile 95 preferences"
label var alll "Overall preferences (left voters)"
label var q1l "Quintile 1 preferences (left voters)"
label var q2l "Quintile 2 preferences (left voters)"
label var q3l "Quintile 3 preferences (left voters)"
label var q4l "Quintile 4 preferences (left voters)"
label var q5l "Quintile 5 preferences (left voters)"
label var p05l "Percentile 5 preferences (left voters)"
label var p10l "Percentile 10 preferences (left voters)"
label var p30l "Percentile 30 preferences (left voters)"
label var p50l "Percentile 50 preferences (left voters)"
label var p70l "Percentile 70 preferences (left voters)"
label var p90l "Percentile 90 preferences (left voters)"
label var p95l "Percentile 95 preferences (left voters)"
label var allr "Overall preferences (right voters)"
label var q1r "Quintile 1 preferences (right voters)"
label var q2r "Quintile 2 preferences (right voters)"
label var q3r "Quintile 3 preferences (right voters)"
label var q4r "Quintile 4 preferences (right voters)"
label var q5r "Quintile 5 preferences (right voters)"
label var p05r "Percentile 5 preferences (right voters)"
label var p10r "Percentile 10 preferences (right voters)"
label var p30r "Percentile 30 preferences (right voters)"
label var p50r "Percentile 50 preferences (right voters)"
label var p70r "Percentile 70 preferences (right voters)"
label var p90r "Percentile 90 preferences (right voters)"
label var p95r "Percentile 95 preferences (right voters)"
label var p10v "Percentile 10 preferences (voters)"
label var p50v "Percentile 50 preferences (voters)"
label var p90v "Percentile 90 preferences (voters)"
label var p10nv "Percentile 10 preferences (non-voters)"
label var p50nv "Percentile 50 preferences (non-voters)"
label var p90nv "Percentile 90 preferences (non-voters)"
label var e1 "Education Q1 preferences"
label var e2 "Education Q2 preferences"
label var e3 "Education Q3 preferences"
label var e4 "Education Q4 preferences"
label var e5 "Education Q5 preferences"
label var i1e1 "Income Q1, Education Q1 preferences"
label var i1e2 "Income Q1, Education Q2 preferences"
label var i1e3 "Income Q1, Education Q3 preferences"
label var i1e4 "Income Q1, Education Q4 preferences"
label var i1e5 "Income Q1, Education Q5 preferences"
label var i2e1 "Income Q2, Education Q1 preferences"
label var i2e2 "Income Q2, Education Q2 preferences"
label var i2e3 "Income Q2, Education Q3 preferences"
label var i2e4 "Income Q2, Education Q4 preferences"
label var i2e5 "Income Q2, Education Q5 preferences"
label var i3e1 "Income Q3, Education Q1 preferences"
label var i3e2 "Income Q3, Education Q2 preferences"
label var i3e3 "Income Q3, Education Q3 preferences"
label var i3e4 "Income Q3, Education Q4 preferences"
label var i3e5 "Income Q3, Education Q5 preferences"
label var i4e1 "Income Q4, Education Q1 preferences"
label var i4e2 "Income Q4, Education Q2 preferences"
label var i4e3 "Income Q4, Education Q3 preferences"
label var i4e4 "Income Q4, Education Q4 preferences"
label var i4e5 "Income Q4, Education Q5 preferences"
label var i5e1 "Income Q5, Education Q1 preferences"
label var i5e2 "Income Q5, Education Q2 preferences"
label var i5e3 "Income Q5, Education Q3 preferences"
label var i5e4 "Income Q5, Education Q4 preferences"
label var i5e5 "Income Q5, Education Q5 preferences"
label var weight10 "Weight, P10"
label var weight30 "Weight, P30"
label var weight50 "Weight, P50"
label var weight70 "Weight, P70"
label var weight90 "Weight, P90"
label var welrel "Welfare reliability coefficient"
label var legpit "Average attention of legislature, PI (t)"
label var legpit1 "Average attention of legislature, PI (t+1)"
label var legpit2 "Average attention of legislature, PI (t+2)"
label var legpit3 "Average attention of legislature, PI (t+3)"
label var legpit4 "Average attention of legislature, PI (t+4)"
label var legpit5 "Average attention of legislature, PI (t+5)"
label var legpitmin1 "Average attention of legislature, PI (t-1)"
label var legpitmin2 "Average attention of legislature, PI (t-2)"
label var legpitmin3 "Average attention of legislature, PI (t-3)"
label var legpitmin4 "Average attention of legislature, PI (t-4)"
label var legpitmin5 "Average attention of legislature, PI (t-5)"
label var llegpit "Average logged attention of legislature, PI (t)"
label var llegpit1 "Average logged attention of legislature, PI (t+1)"
label var llegpit2 "Average logged attention of legislature, PI (t+2)"
label var llegpit3 "Average logged attention of legislature, PI (t+3)"
label var llegpit4 "Average logged attention of legislature, PI (t+4)"
label var llegpit5 "Average logged attention of legislature, PI (t+5)"
label var llegpitmin1 "Average logged attention of legislature, PI (t-1)"
label var llegpitmin2 "Average logged attention of legislature, PI (t-2)"
label var llegpitmin3 "Average logged attention of legislature, PI (t-3)"
label var llegpitmin4 "Average logged attention of legislature, PI (t-4)"
label var llegpitmin5 "Average logged attention of legislature, PI (t-5)"
label var legsit "Average attention of legislature, SI (t)"
label var legsit1 "Average attention of legislature, SI (t+1)"
label var legsit2 "Average attention of legislature, SI (t+2)"
label var legsit3 "Average attention of legislature, SI (t+3)"
label var legsit4 "Average attention of legislature, SI (t+4)"
label var legsit5 "Average attention of legislature, SI (t+5)"
label var legsitmin1 "Average attention of legislature, SI (t-1)"
label var legsitmin2 "Average attention of legislature, SI (t-2)"
label var legsitmin3 "Average attention of legislature, SI (t-3)"
label var legsitmin4 "Average attention of legislature, SI (t-4)"
label var legsitmin5 "Average attention of legislature, SI (t-5)"
label var llegsit "Average logged attention of legislature, SI (t)"
label var llegsit1 "Average logged attention of legislature, SI (t+1)"
label var llegsit2 "Average logged attention of legislature, SI (t+2)"
label var llegsit3 "Average logged attention of legislature, SI (t+3)"
label var llegsit4 "Average logged attention of legislature, SI (t+4)"
label var llegsit5 "Average logged attention of legislature, SI (t+5)"
label var llegsitmin1 "Average logged attention of legislature, SI (t-1)"
label var llegsitmin2 "Average logged attention of legislature, SI (t-2)"
label var llegsitmin3 "Average logged attention of legislature, SI (t-3)"
label var llegsitmin4 "Average logged attention of legislature, SI (t-4)"
label var llegsitmin5 "Average logged attention of legislature, SI (t-5)"
label var dlegpitav13 "Change in attention of legislature, PI (t+1 - t+3)"
label var dlegpitav14 "Change in attention of legislature, PI (t+1 - t+4)"
label var dlegpitav15 "Change in attention of legislature, PI (t+1 - t+5)"
label var dllegpitav13 "Change in logged attention of legislature, PI (t+1 - t+3)"
label var dllegpitav14 "Change in logged attention of legislature, PI (t+1 - t+4)"
label var dllegpitav15 "Change in logged attention of legislature, PI (t+1 - t+5)"
label var dlegsitav13 "Change in attention of legislature, SI (t+1 - t+3)"
label var dlegsitav14 "Change in attention of legislature, SI (t+1 - t+4)"
label var dlegsitav15 "Change in attention of legislature, SI (t+1 - t+5)"
label var dllegsitav13 "Change in logged attention of legislature, SI (t+1 - t+3)"
label var dllegsitav14 "Change in logged attention of legislature, SI (t+1 - t+4)"
label var dllegsitav15 "Change in logged attention of legislature, SI (t+1 - t+5)"
label var govpit "Average attention of government, PI (t)"
label var govpit1 "Average attention of government, PI (t+1)"
label var govpit2 "Average attention of government, PI (t+2)"
label var govpit3 "Average attention of government, PI (t+3)"
label var govpit4 "Average attention of government, PI (t+4)"
label var govpit5 "Average attention of government, PI (t+5)"
label var govpitmin1 "Average attention of government, PI (t-1)"
label var govpitmin2 "Average attention of government, PI (t-2)"
label var govpitmin3 "Average attention of government, PI (t-3)"
label var govpitmin4 "Average attention of government, PI (t-4)"
label var govpitmin5 "Average attention of government, PI (t-5)"
label var lgovpit "Average logged attention of government, PI (t)"
label var lgovpit1 "Average logged attention of government, PI (t+1)"
label var lgovpit2 "Average logged attention of government, PI (t+2)"
label var lgovpit3 "Average logged attention of government, PI (t+3)"
label var lgovpit4 "Average logged attention of government, PI (t+4)"
label var lgovpit5 "Average logged attention of government, PI (t+5)"
label var lgovpitmin1 "Average logged attention of government, PI (t-1)"
label var lgovpitmin2 "Average logged attention of government, PI (t-2)"
label var lgovpitmin3 "Average logged attention of government, PI (t-3)"
label var lgovpitmin4 "Average logged attention of government, PI (t-4)"
label var lgovpitmin5 "Average logged attention of government, PI (t-5)"
label var govsit "Average attention of government, SI (t)"
label var govsit1 "Average attention of government, SI (t+1)"
label var govsit2 "Average attention of government, SI (t+2)"
label var govsit3 "Average attention of government, SI (t+3)"
label var govsit4 "Average attention of government, SI (t+4)"
label var govsit5 "Average attention of government, SI (t+5)"
label var govsitmin1 "Average attention of government, SI (t-1)"
label var govsitmin2 "Average attention of government, SI (t-2)"
label var govsitmin3 "Average attention of government, SI (t-3)"
label var govsitmin4 "Average attention of government, SI (t-4)"
label var govsitmin5 "Average attention of government, SI (t-5)"
label var lgovsit "Average logged attention of government, SI (t)"
label var lgovsit1 "Average logged attention of government, SI (t+1)"
label var lgovsit2 "Average logged attention of government, SI (t+2)"
label var lgovsit3 "Average logged attention of government, SI (t+3)"
label var lgovsit4 "Average logged attention of government, SI (t+4)"
label var lgovsit5 "Average logged attention of government, SI (t+5)"
label var lgovsitmin1 "Average logged attention of government, SI (t-1)"
label var lgovsitmin2 "Average logged attention of government, SI (t-2)"
label var lgovsitmin3 "Average logged attention of government, SI (t-3)"
label var lgovsitmin4 "Average logged attention of government, SI (t-4)"
label var lgovsitmin5 "Average logged attention of government, SI (t-5)"
label var dgovpitav13 "Change in attention of government, PI (t+1 - t+3)"
label var dgovpitav14 "Change in attention of government, PI (t+1 - t+4)"
label var dgovpitav15 "Change in attention of government, PI (t+1 - t+5)"
label var dlgovpitav13 "Change in logged attention of government, PI (t+1 - t+3)"
label var dlgovpitav14 "Change in logged attention of government, PI (t+1 - t+4)"
label var dlgovpitav15 "Change in logged attention of government, PI (t+1 - t+5)"
label var dgovsitav13 "Change in attention of government, SI (t+1 - t+3)"
label var dgovsitav14 "Change in attention of government, SI (t+1 - t+4)"
label var dgovsitav15 "Change in attention of government, SI (t+1 - t+5)"
label var dlgovsitav13 "Change in logged attention of government, SI (t+1 - t+3)"
label var dlgovsitav14 "Change in logged attention of government, SI (t+1 - t+4)"
label var dlgovsitav15 "Change in logged attention of government, SI (t+1 - t+5)"
label var leftpit "Average attention of left parties, PI (t)"
label var leftpit1 "Average attention of left parties, PI (t+1)"
label var leftpit2 "Average attention of left parties, PI (t+2)"
label var leftpit3 "Average attention of left parties, PI (t+3)"
label var leftpit4 "Average attention of left parties, PI (t+4)"
label var leftpit5 "Average attention of left parties, PI (t+5)"
label var leftpitmin1 "Average attention of left parties, PI (t-1)"
label var leftpitmin2 "Average attention of left parties, PI (t-2)"
label var leftpitmin3 "Average attention of left parties, PI (t-3)"
label var leftpitmin4 "Average attention of left parties, PI (t-4)"
label var leftpitmin5 "Average attention of left parties, PI (t-5)"
label var lleftpit "Average logged attention of left parties, PI (t)"
label var lleftpit1 "Average logged attention of left parties, PI (t+1)"
label var lleftpit2 "Average logged attention of left parties, PI (t+2)"
label var lleftpit3 "Average logged attention of left parties, PI (t+3)"
label var lleftpit4 "Average logged attention of left parties, PI (t+4)"
label var lleftpit5 "Average logged attention of left parties, PI (t+5)"
label var lleftpitmin1 "Average logged attention of left parties, PI (t-1)"
label var lleftpitmin2 "Average logged attention of left parties, PI (t-2)"
label var lleftpitmin3 "Average logged attention of left parties, PI (t-3)"
label var lleftpitmin4 "Average logged attention of left parties, PI (t-4)"
label var lleftpitmin5 "Average logged attention of left parties, PI (t-5)"
label var leftsit "Average attention of left parties, SI (t)"
label var leftsit1 "Average attention of left parties, SI (t+1)"
label var leftsit2 "Average attention of left parties, SI (t+2)"
label var leftsit3 "Average attention of left parties, SI (t+3)"
label var leftsit4 "Average attention of left parties, SI (t+4)"
label var leftsit5 "Average attention of left parties, SI (t+5)"
label var leftsitmin1 "Average attention of left parties, SI (t-1)"
label var leftsitmin2 "Average attention of left parties, SI (t-2)"
label var leftsitmin3 "Average attention of left parties, SI (t-3)"
label var leftsitmin4 "Average attention of left parties, SI (t-4)"
label var leftsitmin5 "Average attention of left parties, SI (t-5)"
label var lleftsit "Average logged attention of left parties, SI (t)"
label var lleftsit1 "Average logged attention of left parties, SI (t+1)"
label var lleftsit2 "Average logged attention of left parties, SI (t+2)"
label var lleftsit3 "Average logged attention of left parties, SI (t+3)"
label var lleftsit4 "Average logged attention of left parties, SI (t+4)"
label var lleftsit5 "Average logged attention of left parties, SI (t+5)"
label var lleftsitmin1 "Average logged attention of left parties, SI (t-1)"
label var lleftsitmin2 "Average logged attention of left parties, SI (t-2)"
label var lleftsitmin3 "Average logged attention of left parties, SI (t-3)"
label var lleftsitmin4 "Average logged attention of left parties, SI (t-4)"
label var lleftsitmin5 "Average logged attention of left parties, SI (t-5)"
label var dleftpitav13 "Change in attention of left parties, PI (t+1 - t+3)"
label var dleftpitav14 "Change in attention of left parties, PI (t+1 - t+4)"
label var dleftpitav15 "Change in attention of left parties, PI (t+1 - t+5)"
label var dlleftpitav13 "Change in logged attention of left parties, PI (t+1 - t+3)"
label var dlleftpitav14 "Change in logged attention of left parties, PI (t+1 - t+4)"
label var dlleftpitav15 "Change in logged attention of left parties, PI (t+1 - t+5)"
label var dleftsitav13 "Change in attention of left parties, SI (t+1 - t+3)"
label var dleftsitav14 "Change in attention of left parties, SI (t+1 - t+4)"
label var dleftsitav15 "Change in attention of left parties, SI (t+1 - t+5)"
label var dlleftsitav13 "Change in logged attention of left parties, SI (t+1 - t+3)"
label var dlleftsitav14 "Change in logged attention of left parties, SI (t+1 - t+4)"
label var dlleftsitav15 "Change in logged attention of left parties, SI (t+1 - t+5)"
label var rightpit "Average attention of right parties, PI (t)"
label var rightpit1 "Average attention of right parties, PI (t+1)"
label var rightpit2 "Average attention of right parties, PI (t+2)"
label var rightpit3 "Average attention of right parties, PI (t+3)"
label var rightpit4 "Average attention of right parties, PI (t+4)"
label var rightpit5 "Average attention of right parties, PI (t+5)"
label var rightpitmin1 "Average attention of right parties, PI (t-1)"
label var rightpitmin2 "Average attention of right parties, PI (t-2)"
label var rightpitmin3 "Average attention of right parties, PI (t-3)"
label var rightpitmin4 "Average attention of right parties, PI (t-4)"
label var rightpitmin5 "Average attention of right parties, PI (t-5)"
label var lrightpit "Average logged attention of right parties, PI (t)"
label var lrightpit1 "Average logged attention of right parties, PI (t+1)"
label var lrightpit2 "Average logged attention of right parties, PI (t+2)"
label var lrightpit3 "Average logged attention of right parties, PI (t+3)"
label var lrightpit4 "Average logged attention of right parties, PI (t+4)"
label var lrightpit5 "Average logged attention of right parties, PI (t+5)"
label var lrightpitmin1 "Average logged attention of right parties, PI (t-1)"
label var lrightpitmin2 "Average logged attention of right parties, PI (t-2)"
label var lrightpitmin3 "Average logged attention of right parties, PI (t-3)"
label var lrightpitmin4 "Average logged attention of right parties, PI (t-4)"
label var lrightpitmin5 "Average logged attention of right parties, PI (t-5)"
label var rightsit "Average attention of right parties, SI (t)"
label var rightsit1 "Average attention of right parties, SI (t+1)"
label var rightsit2 "Average attention of right parties, SI (t+2)"
label var rightsit3 "Average attention of right parties, SI (t+3)"
label var rightsit4 "Average attention of right parties, SI (t+4)"
label var rightsit5 "Average attention of right parties, SI (t+5)"
label var rightsitmin1 "Average attention of right parties, SI (t-1)"
label var rightsitmin2 "Average attention of right parties, SI (t-2)"
label var rightsitmin3 "Average attention of right parties, SI (t-3)"
label var rightsitmin4 "Average attention of right parties, SI (t-4)"
label var rightsitmin5 "Average attention of right parties, SI (t-5)"
label var lrightsit "Average logged attention of right parties, SI (t)"
label var lrightsit1 "Average logged attention of right parties, SI (t+1)"
label var lrightsit2 "Average logged attention of right parties, SI (t+2)"
label var lrightsit3 "Average logged attention of right parties, SI (t+3)"
label var lrightsit4 "Average logged attention of right parties, SI (t+4)"
label var lrightsit5 "Average logged attention of right parties, SI (t+5)"
label var lrightsitmin1 "Average logged attention of right parties, SI (t-1)"
label var lrightsitmin2 "Average logged attention of right parties, SI (t-2)"
label var lrightsitmin3 "Average logged attention of right parties, SI (t-3)"
label var lrightsitmin4 "Average logged attention of right parties, SI (t-4)"
label var lrightsitmin5 "Average logged attention of right parties, SI (t-5)"
label var drightpitav13 "Change in attention of right parties, PI (t+1 - t+3)"
label var drightpitav14 "Change in attention of right parties, PI (t+1 - t+4)"
label var drightpitav15 "Change in attention of right parties, PI (t+1 - t+5)"
label var dlrightpitav13 "Change in logged attention of right parties, PI (t+1 - t+3)"
label var dlrightpitav14 "Change in logged attention of right parties, PI (t+1 - t+4)"
label var dlrightpitav15 "Change in logged attention of right parties, PI (t+1 - t+5)"
label var drightsitav13 "Change in attention of right parties, SI (t+1 - t+3)"
label var drightsitav14 "Change in attention of right parties, SI (t+1 - t+4)"
label var drightsitav15 "Change in attention of right parties, SI (t+1 - t+5)"
label var dlrightsitav13 "Change in logged attention of right parties, SI (t+1 - t+3)"
label var dlrightsitav14 "Change in logged attention of right parties, SI (t+1 - t+4)"
label var dlrightsitav15 "Change in logged attention of right parties, SI (t+1 - t+5)"
label var sdpit "Average attention of social democratic parties, PI (t)"
label var sdpit1 "Average attention of social democratic parties, PI (t+1)"
label var sdpit2 "Average attention of social democratic parties, PI (t+2)"
label var sdpit3 "Average attention of social democratic parties, PI (t+3)"
label var sdpit4 "Average attention of social democratic parties, PI (t+4)"
label var sdpit5 "Average attention of social democratic parties, PI (t+5)"
label var sdpitmin1 "Average attention of social democratic parties, PI (t-1)"
label var sdpitmin2 "Average attention of social democratic parties, PI (t-2)"
label var sdpitmin3 "Average attention of social democratic parties, PI (t-3)"
label var sdpitmin4 "Average attention of social democratic parties, PI (t-4)"
label var sdpitmin5 "Average attention of social democratic parties, PI (t-5)"
label var lsdpit "Average logged attention of social democratic parties, PI (t)"
label var lsdpit1 "Average logged attention of social democratic parties, PI (t+1)"
label var lsdpit2 "Average logged attention of social democratic parties, PI (t+2)"
label var lsdpit3 "Average logged attention of social democratic parties, PI (t+3)"
label var lsdpit4 "Average logged attention of social democratic parties, PI (t+4)"
label var lsdpit5 "Average logged attention of social democratic parties, PI (t+5)"
label var lsdpitmin1 "Average logged attention of social democratic parties, PI (t-1)"
label var lsdpitmin2 "Average logged attention of social democratic parties, PI (t-2)"
label var lsdpitmin3 "Average logged attention of social democratic parties, PI (t-3)"
label var lsdpitmin4 "Average logged attention of social democratic parties, PI (t-4)"
label var lsdpitmin5 "Average logged attention of social democratic parties, PI (t-5)"
label var socpit "Average attention of socialist parties, PI (t)"
label var socpit1 "Average attention of socialist parties, PI (t+1)"
label var socpit2 "Average attention of socialist parties, PI (t+2)"
label var socpit3 "Average attention of socialist parties, PI (t+3)"
label var socpit4 "Average attention of socialist parties, PI (t+4)"
label var socpit5 "Average attention of socialist parties, PI (t+5)"
label var socpitmin1 "Average attention of socialist parties, PI (t-1)"
label var socpitmin2 "Average attention of socialist parties, PI (t-2)"
label var socpitmin3 "Average attention of socialist parties, PI (t-3)"
label var socpitmin4 "Average attention of socialist parties, PI (t-4)"
label var socpitmin5 "Average attention of socialist parties, PI (t-5)"
label var lsocpit "Average logged attention of socialist parties, PI (t)"
label var lsocpit1 "Average logged attention of socialist parties, PI (t+1)"
label var lsocpit2 "Average logged attention of socialist parties, PI (t+2)"
label var lsocpit3 "Average logged attention of socialist parties, PI (t+3)"
label var lsocpit4 "Average logged attention of socialist parties, PI (t+4)"
label var lsocpit5 "Average logged attention of socialist parties, PI (t+5)"
label var lsocpitmin1 "Average logged attention of socialist parties, PI (t-1)"
label var lsocpitmin2 "Average logged attention of socialist parties, PI (t-2)"
label var lsocpitmin3 "Average logged attention of socialist parties, PI (t-3)"
label var lsocpitmin4 "Average logged attention of socialist parties, PI (t-4)"
label var lsocpitmin5 "Average logged attention of socialist parties, PI (t-5)"
label var grpit "Average attention of green parties, PI (t)"
label var grpit1 "Average attention of green parties, PI (t+1)"
label var grpit2 "Average attention of green parties, PI (t+2)"
label var grpit3 "Average attention of green parties, PI (t+3)"
label var grpit4 "Average attention of green parties, PI (t+4)"
label var grpit5 "Average attention of green parties, PI (t+5)"
label var grpitmin1 "Average attention of green parties, PI (t-1)"
label var grpitmin2 "Average attention of green parties, PI (t-2)"
label var grpitmin3 "Average attention of green parties, PI (t-3)"
label var grpitmin4 "Average attention of green parties, PI (t-4)"
label var grpitmin5 "Average attention of green parties, PI (t-5)"
label var lgrpit "Average logged attention of green parties, PI (t)"
label var lgrpit1 "Average logged attention of green parties, PI (t+1)"
label var lgrpit2 "Average logged attention of green parties, PI (t+2)"
label var lgrpit3 "Average logged attention of green parties, PI (t+3)"
label var lgrpit4 "Average logged attention of green parties, PI (t+4)"
label var lgrpit5 "Average logged attention of green parties, PI (t+5)"
label var lgrpitmin1 "Average logged attention of green parties, PI (t-1)"
label var lgrpitmin2 "Average logged attention of green parties, PI (t-2)"
label var lgrpitmin3 "Average logged attention of green parties, PI (t-3)"
label var lgrpitmin4 "Average logged attention of green parties, PI (t-4)"
label var lgrpitmin5 "Average logged attention of green parties, PI (t-5)"
label var libpit "Average attention of liberal parties, PI (t)"
label var libpit1 "Average attention of liberal parties, PI (t+1)"
label var libpit2 "Average attention of liberal parties, PI (t+2)"
label var libpit3 "Average attention of liberal parties, PI (t+3)"
label var libpit4 "Average attention of liberal parties, PI (t+4)"
label var libpit5 "Average attention of liberal parties, PI (t+5)"
label var libpitmin1 "Average attention of liberal parties, PI (t-1)"
label var libpitmin2 "Average attention of liberal parties, PI (t-2)"
label var libpitmin3 "Average attention of liberal parties, PI (t-3)"
label var libpitmin4 "Average attention of liberal parties, PI (t-4)"
label var libpitmin5 "Average attention of liberal parties, PI (t-5)"
label var llibpit "Average logged attention of liberal parties, PI (t)"
label var llibpit1 "Average logged attention of liberal parties, PI (t+1)"
label var llibpit2 "Average logged attention of liberal parties, PI (t+2)"
label var llibpit3 "Average logged attention of liberal parties, PI (t+3)"
label var llibpit4 "Average logged attention of liberal parties, PI (t+4)"
label var llibpit5 "Average logged attention of liberal parties, PI (t+5)"
label var llibpitmin1 "Average logged attention of liberal parties, PI (t-1)"
label var llibpitmin2 "Average logged attention of liberal parties, PI (t-2)"
label var llibpitmin3 "Average logged attention of liberal parties, PI (t-3)"
label var llibpitmin4 "Average logged attention of liberal parties, PI (t-4)"
label var llibpitmin5 "Average logged attention of liberal parties, PI (t-5)"
label var conpit "Average attention of conservative parties, PI (t)"
label var conpit1 "Average attention of conservative parties, PI (t+1)"
label var conpit2 "Average attention of conservative parties, PI (t+2)"
label var conpit3 "Average attention of conservative parties, PI (t+3)"
label var conpit4 "Average attention of conservative parties, PI (t+4)"
label var conpit5 "Average attention of conservative parties, PI (t+5)"
label var conpitmin1 "Average attention of conservative parties, PI (t-1)"
label var conpitmin2 "Average attention of conservative parties, PI (t-2)"
label var conpitmin3 "Average attention of conservative parties, PI (t-3)"
label var conpitmin4 "Average attention of conservative parties, PI (t-4)"
label var conpitmin5 "Average attention of conservative parties, PI (t-5)"
label var lconpit "Average logged attention of conservative parties, PI (t)"
label var lconpit1 "Average logged attention of conservative parties, PI (t+1)"
label var lconpit2 "Average logged attention of conservative parties, PI (t+2)"
label var lconpit3 "Average logged attention of conservative parties, PI (t+3)"
label var lconpit4 "Average logged attention of conservative parties, PI (t+4)"
label var lconpit5 "Average logged attention of conservative parties, PI (t+5)"
label var lconpitmin1 "Average logged attention of conservative parties, PI (t-1)"
label var lconpitmin2 "Average logged attention of conservative parties, PI (t-2)"
label var lconpitmin3 "Average logged attention of conservative parties, PI (t-3)"
label var lconpitmin4 "Average logged attention of conservative parties, PI (t-4)"
label var lconpitmin5 "Average logged attention of conservative parties, PI (t-5)"
label var cdpit "Average attention of Christian democratic parties, PI (t)"
label var cdpit1 "Average attention of Christian democratic parties, PI (t+1)"
label var cdpit2 "Average attention of Christian democratic parties, PI (t+2)"
label var cdpit3 "Average attention of Christian democratic parties, PI (t+3)"
label var cdpit4 "Average attention of Christian democratic parties, PI (t+4)"
label var cdpit5 "Average attention of Christian democratic parties, PI (t+5)"
label var cdpitmin1 "Average attention of Christian democratic parties, PI (t-1)"
label var cdpitmin2 "Average attention of Christian democratic parties, PI (t-2)"
label var cdpitmin3 "Average attention of Christian democratic parties, PI (t-3)"
label var cdpitmin4 "Average attention of Christian democratic parties, PI (t-4)"
label var cdpitmin5 "Average attention of Christian democratic parties, PI (t-5)"
label var lcdpit "Average logged attention of Christian democratic parties, PI (t)"
label var lcdpit1 "Average logged attention of Christian democratic parties, PI (t+1)"
label var lcdpit2 "Average logged attention of Christian democratic parties, PI (t+2)"
label var lcdpit3 "Average logged attention of Christian democratic parties, PI (t+3)"
label var lcdpit4 "Average logged attention of Christian democratic parties, PI (t+4)"
label var lcdpit5 "Average logged attention of Christian democratic parties, PI (t+5)"
label var lcdpitmin1 "Average logged attention of Christian democratic parties, PI (t-1)"
label var lcdpitmin2 "Average logged attention of Christian democratic parties, PI (t-2)"
label var lcdpitmin3 "Average logged attention of Christian democratic parties, PI (t-3)"
label var lcdpitmin4 "Average logged attention of Christian democratic parties, PI (t-4)"
label var lcdpitmin5 "Average logged attention of Christian democratic parties, PI (t-5)"
label var legnwt "Average attention of legislature, non-weighted (t)"
label var legnwt1 "Average attention of legislature, non-weighted (t+1)"
label var legnwt2 "Average attention of legislature, non-weighted (t+2)"
label var legnwt3 "Average attention of legislature, non-weighted (t+3)"
label var legnwt4 "Average attention of legislature, non-weighted (t+4)"
label var legnwt5 "Average attention of legislature, non-weighted (t+5)"
label var legnwtmin1 "Average attention of legislature, non-weighted (t-1)"
label var legnwtmin2 "Average attention of legislature, non-weighted (t-2)"
label var legnwtmin3 "Average attention of legislature, non-weighted (t-3)"
label var legnwtmin4 "Average attention of legislature, non-weighted (t-4)"
label var legnwtmin5 "Average attention of legislature, non-weighted (t-5)"
label var llegnwt "Average logged attention of legislature, non-weighted (t)"
label var llegnwt1 "Average logged attention of legislature, non-weighted (t+1)"
label var llegnwt2 "Average logged attention of legislature, non-weighted (t+2)"
label var llegnwt3 "Average logged attention of legislature, non-weighted (t+3)"
label var llegnwt4 "Average logged attention of legislature, non-weighted (t+4)"
label var llegnwt5 "Average logged attention of legislature, non-weighted (t+5)"
label var llegnwtmin1 "Average logged attention of legislature, non-weighted (t-1)"
label var llegnwtmin2 "Average logged attention of legislature, non-weighted (t-2)"
label var llegnwtmin3 "Average logged attention of legislature, non-weighted (t-3)"
label var llegnwtmin4 "Average logged attention of legislature, non-weighted (t-4)"
label var llegnwtmin5 "Average logged attention of legislature, non-weighted (t-5)"
label var dlegnwtav13 "Change in attention of legislature, non-weighted (t+1 - t+3)"
label var dlegnwtav14 "Change in attention of legislature, non-weighted (t+1 - t+4)"
label var dlegnwtav15 "Change in attention of legislature, non-weighted (t+1 - t+5)"
label var dllegnwtav13 "Change in logged attention of legislature, non-weighted (t+1 - t+3)"
label var dllegnwtav14 "Change in logged attention of legislature, non-weighted (t+1 - t+4)"
label var dllegnwtav15 "Change in logged attention of legislature, non-weighted (t+1 - t+5)"
label var legnit "Average attention of legislature, no interpolation (t)"
label var legnit1 "Average attention of legislature, no interpolation (t+1)"
label var legnit2 "Average attention of legislature, no interpolation (t+2)"
label var legnit3 "Average attention of legislature, no interpolation (t+3)"
label var legnit4 "Average attention of legislature, no interpolation (t+4)"
label var legnit5 "Average attention of legislature, no interpolation (t+5)"
label var legnitmin1 "Average attention of legislature, no interpolation (t-1)"
label var legnitmin2 "Average attention of legislature, no interpolation (t-2)"
label var legnitmin3 "Average attention of legislature, no interpolation (t-3)"
label var legnitmin4 "Average attention of legislature, no interpolation (t-4)"
label var legnitmin5 "Average attention of legislature, no interpolation (t-5)"
label var llegnit "Average logged attention of legislature, no interpolation (t)"
label var llegnit1 "Average logged attention of legislature, no interpolation (t+1)"
label var llegnit2 "Average logged attention of legislature, no interpolation (t+2)"
label var llegnit3 "Average logged attention of legislature, no interpolation (t+3)"
label var llegnit4 "Average logged attention of legislature, no interpolation (t+4)"
label var llegnit5 "Average logged attention of legislature, no interpolation (t+5)"
label var llegnitmin1 "Average logged attention of legislature, no interpolation (t-1)"
label var llegnitmin2 "Average logged attention of legislature, no interpolation (t-2)"
label var llegnitmin3 "Average logged attention of legislature, no interpolation (t-3)"
label var llegnitmin4 "Average logged attention of legislature, no interpolation (t-4)"
label var llegnitmin5 "Average logged attention of legislature, no interpolation (t-5)"
label var dlegnitav13 "Change in attention of legislature, no interpolation (t+1 - t+3)"
label var dlegnitav14 "Change in attention of legislature, no interpolation (t+1 - t+4)"
label var dlegnitav15 "Change in attention of legislature, no interpolation (t+1 - t+5)"
label var dllegnitav13 "Change in logged attention of legislature, no interpolation (t+1 - t+3)"
label var dllegnitav14 "Change in logged attention of legislature, no interpolation (t+1 - t+4)"
label var dllegnitav15 "Change in logged attention of legislature, no interpolation (t+1 - t+5)"
label var llegnite1 "Average logged attention of legislature, next election"
label var gdpt "GDP per capita (t)"
label var gdpt1 "GDP per capita (t+1)"
label var gdpt2 "GDP per capita (t+2)"
label var gdpt3 "GDP per capita (t+3)"
label var gdpt4 "GDP per capita (t+4)"
label var gdpt5 "GDP per capita (t+5)"
label var dgdptav13 "Average change in GDP per capita (t+1 - t+3)"
label var dgdptav14 "Average change in GDP per capita (t+1 - t+4)"
label var dgdptav15 "Average change in GDP per capita (t+1 - t+5)"
label var growtht "GDP % growth (t)"
label var growtht1 "GDP % growth (t+1)"
label var growtht2 "GDP % growth (t+2)"
label var growtht3 "GDP % growth (t+3)"
label var growtht4 "GDP % growth (t+4)"
label var growtht5 "GDP % growth (t+5)"
label var dgrowthtav13 "Average change in GDP growth (t+1 - t+3)"
label var dgrowthtav14 "Average change in GDP growth (t+1 - t+4)"
label var dgrowthtav15 "Average change in GDP growth (t+1 - t+5)"
label var unempt "Unemployment % (t)"
label var unempt1 "Unemployment % (t+1)"
label var unempt2 "Unemployment % (t+2)"
label var unempt3 "Unemployment % (t+3)"
label var unempt4 "Unemployment % (t+4)"
label var unempt5 "Unemployment % (t+5)"
label var dunemptav13 "Average change in unemployment (t+1 - t+3)"
label var dunemptav14 "Average change in unemployment (t+1 - t+4)"
label var dunemptav15 "Average change in unemployment (t+1 - t+5)"
label var spend "Government spending (t)"
label var loggdpt "GDP per capita, logged (t)"
label var elecsys "Electoral system"
label var gini "Gini coefficient"
label var agedem "Age of democracy"
label var turnout "Voter turnout (most recent parliamentary election)"
label var turnout2 "Voter turnout (most recent presidential election)"
label var effpar "Effective number of parties"
label var adm "Average district magnitude"
label var logadm "Average district magnitude (logged)"
label var fedcat "Federalism (categories)"
label var fedindex "Federalism (index)"
label var ud "Union density (interpolated)"
label var cbc "Collective bargaining coverage"
label var vdem_egal "Egalitarian democracy index (V-Dem)"
label var vdem_egal2 "Power distributed by socioeconomic position (V-Dem)"
label var campreg "Campaign finance regulations (average)"

sort id

save "$data\Schakel_2020_Chapter4_1_Data.dta", replace
